/* ============================================================
   起始页 设计系统 v2 —— Modern Glass Design System
   品牌色：靛蓝 → 紫 渐变 / 毛玻璃 / 大圆角 / 柔和阴影
   ============================================================ */

:root {
    --brand: #4f6bff;
    --brand-2: #8b5cf6;
    --brand-grad: linear-gradient(135deg, #4f6bff 0%, #8b5cf6 100%);
    --danger: #ff4d4f;
    --success: #34c759;
    --warning: #ff9f0a;

    --glass: rgba(255, 255, 255, 0.72);
    --glass-strong: rgba(255, 255, 255, 0.86);
    --glass-weak: rgba(255, 255, 255, 0.45);
    --glass-border: rgba(255, 255, 255, 0.65);
    --glass-inner: rgba(255, 255, 255, 0.5);

    --text-1: #1c1f27;
    --text-2: #5b6270;
    --text-3: #9aa1ae;
    --line: rgba(28, 31, 39, 0.08);

    --r-lg: 20px;
    --r-md: 14px;
    --r-sm: 10px;

    --shadow-1: 0 2px 8px rgba(20, 24, 40, 0.06);
    --shadow-2: 0 10px 32px rgba(20, 24, 40, 0.12);
    --shadow-3: 0 24px 64px rgba(20, 24, 40, 0.22);
    --ring: 0 0 0 3px rgba(79, 107, 255, 0.25);

    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --icon-scale: 1;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    color: var(--text-1);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; border: none; background: none; cursor: pointer; }
input, select, textarea { font-family: inherit; outline: none; }
a { color: var(--brand); text-decoration: none; }
::-webkit-scrollbar { width: 0; height: 0; }

/* ---------- 壁纸层 ---------- */
.wallpaper {
    position: fixed; inset: -40px; z-index: -2;
    background: linear-gradient(135deg, #4f6bff 0%, #7c5bf0 45%, #b786f7 100%);
    background-size: cover; background-position: center;
    filter: blur(0px);
    transform: translateZ(0);
    transition: filter 0.4s;
}
.wallpaper-mask {
    position: fixed; inset: 0; z-index: -1;
    background: rgba(8, 10, 24, 0.28);
    transition: background 0.4s;
}

/* ---------- 顶栏 ---------- */
.topbar {
    position: fixed; top: 0; left: 0; right: 0; height: 52px; z-index: 90;
    display: none; /* PC 端隐藏顶栏，仅移动端显示（☰ 切换侧栏） */
    align-items: center; justify-content: space-between;
    padding: 0 18px;
    /*background: rgba(255,255,255,0.08);*/
    /*backdrop-filter: blur(24px) saturate(1.6);*/
    /*-webkit-backdrop-filter: blur(24px) saturate(1.6);*/
    /*border-bottom: 1px solid rgba(255,255,255,0.14);*/
    color: #fff;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.icon-btn {
    width: 34px; height: 34px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    color: inherit; font-size: 17px;
    transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}
.icon-btn:hover { background: rgba(255,255,255,0.16); }
.icon-btn:active { transform: scale(0.92); }
.brand-badge {
    display: inline-flex; align-items: center; gap: 7px;
    font-weight: 700; font-size: 14.5px; letter-spacing: 0.5px;
    color: #fff;
}
.brand-badge i { font-size: 16px; }

.user-chip {
    position: relative;
    display: flex; align-items: center; gap: 8px;
    padding: 4px 12px 4px 4px; border-radius: 999px;
    background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.2);
    cursor: pointer; transition: background 0.2s;
    color: #fff; font-size: 13px;
}
.user-chip:hover { background: rgba(255,255,255,0.24); }
.user-chip .avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--brand-grad); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
}
.user-menu {
    position: absolute; top: calc(100% + 10px); right: 0; min-width: 168px;
    background: var(--glass-strong); backdrop-filter: blur(28px) saturate(1.8);
    border: 1px solid var(--glass-border); border-radius: var(--r-md);
    box-shadow: var(--shadow-2); color: var(--text-1);
    padding: 6px; display: none; z-index: 200;
}
.user-menu.show { display: block; animation: pop-in 0.18s var(--ease); }
.user-menu .um-item {
    display: flex; align-items: center; gap: 9px;
    padding: 9px 11px; border-radius: 9px; font-size: 13.5px;
    color: var(--text-1); cursor: pointer; width: 100%; text-align: left;
}
.user-menu .um-item:hover { background: rgba(79,107,255,0.1); color: var(--brand); }
.user-menu .um-item.danger { color: var(--danger); }
.user-menu .um-item.danger:hover { background: rgba(255,77,79,0.1); }
.user-menu .um-div { height: 1px; background: var(--line); margin: 5px 8px; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px rgba(52,199,89,0.8); }

/* ---------- 工作区 ---------- */
.workspace {
    position: fixed; inset: 0;
    display: flex;
}

/* ---------- 侧栏（窄条） ---------- */
.sidebar {
    width: 68px; flex-shrink: 0; height: 100%;
    padding: 10px 8px 14px;
    background-color: var(--chrome-bg, rgba(255,255,255,0.1));
    backdrop-filter: blur(28px) saturate(1.6);
    -webkit-backdrop-filter: blur(28px) saturate(1.6);
    border-right: 1px solid rgba(255,255,255,0.14);
    display: flex; flex-direction: column; gap: 6px;
    overflow: hidden;
    transition: margin-left 0.3s var(--ease), opacity 0.3s;
}
.sidebar.hide { margin-left: -76px; opacity: 0; }
.side-user {
    position: relative; flex-shrink: 0;
    display: flex; justify-content: center;
    padding: 4px 0 8px; cursor: pointer;
}
.side-user .avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--brand-grad); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px;
    overflow: hidden;
}
.side-user .avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.side-sync { position: absolute; top: 2px; right: 8px; width: 9px; height: 9px; }
/* 用户菜单从窄条向右弹出 */
.side-pop { left: calc(100% + 10px); top: 0; right: auto; }
.side-cats {
    flex: 0 1 auto; min-height: 0; overflow-y: auto;
    display: flex; flex-direction: column; gap: 4px;
    scrollbar-width: none;
}
.side-cats::-webkit-scrollbar { display: none; width: 0; height: 0; }
.category-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 9px 2px 7px; border-radius: 12px;
    color: rgba(255,255,255,0.85); font-size: 11px; line-height: 1.2;
    cursor: pointer; position: relative;
    transition: background 0.2s var(--ease), transform 0.15s;
    user-select: none;
}
.category-item:hover { background: rgba(255,255,255,0.12); }
.category-item.active {
    background: rgba(255,255,255,0.92); color: var(--text-1); font-weight: 600;
    box-shadow: var(--shadow-1);
}
.category-item .ci-icon { font-size: 19px; width: auto; }
.category-item .cat-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-item .cat-del {
    position: absolute; top: 3px; right: 3px;
    width: 18px; height: 18px; border-radius: 6px; font-size: 11px;
    display: none; align-items: center; justify-content: center;
    color: var(--text-3);
}
.category-item:hover .cat-del { display: inline-flex; }
.category-item .cat-del:hover { background: rgba(255,77,79,0.12); color: var(--danger); }
.sidebar-add {
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; padding: 10px 0;
    border: 1.5px dashed rgba(255,255,255,0.4); border-radius: 12px;
    color: rgba(255,255,255,0.85); font-size: 14px; cursor: pointer;
    transition: all 0.2s;
}
.sidebar-add:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.7); }
/* 页面分类功能关闭：隐藏侧栏分类区与添加入口 */
body.cats-hidden .side-cats, body.cats-hidden .sidebar-add { display: none !important; }
.side-flex { flex: 1 1 auto; }
.side-btn {
    display: flex; align-items: center; justify-content: center;
    height: 42px; border-radius: 12px; flex-shrink: 0;
    color: rgba(255,255,255,0.88); font-size: 19px; cursor: pointer;
    transition: background 0.2s var(--ease), transform 0.15s;
}
.side-btn:hover { background: rgba(255,255,255,0.14); }
.side-btn:active { transform: scale(0.94); }

/* ---------- 主区域 ---------- */
.main-area {
    flex: 1 1 auto; min-width: 0; height: 100%;
    display: flex; flex-direction: column; align-items: center;
    overflow: hidden; padding: 30px 42px 0;
}

/* 时钟 */
.clock-hero { text-align: center; color: #fff; margin: 12px 0 26px; user-select: none; flex-shrink: 0; }
.clock-time {
    font-size: 74px; font-weight: 200; letter-spacing: 2px;
    font-variant-numeric: tabular-nums; line-height: 1.05;
    text-shadow: 0 4px 24px rgba(0,0,0,0.25);
    display: flex; align-items: baseline; justify-content: center; gap: 8px;
}
.clock-time .clock-sec { font-size: 26px; font-weight: 300; color: rgba(255,255,255,0.75); }
.clock-date {
    margin-top: 8px; font-size: 14.5px; color: rgba(255,255,255,0.85);
    letter-spacing: 1px;
}

/* 搜索 */
.search-wrap { width: min(620px, 92%); margin-bottom: 34px; position: relative; flex-shrink: 0; }
.search-box {
    display: flex; align-items: center; height: 52px;
    background: var(--glass); backdrop-filter: blur(28px) saturate(1.8);
    -webkit-backdrop-filter: blur(28px) saturate(1.8);
    border: 1px solid var(--glass-border); border-radius: 999px;
    box-shadow: var(--shadow-2); padding: 0 8px 0 6px;
    transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}
.search-box:focus-within { box-shadow: var(--shadow-2), var(--ring); transform: translateY(-1px); }
.engine-pick { position: relative; }
.engine-btn {
    display: flex; align-items: center; gap: 6px; height: 40px;
    padding: 0 10px 0 6px; border-radius: 999px; cursor: pointer;
    transition: background 0.2s;
}
.engine-btn:hover { background: rgba(28,31,39,0.06); }
.engine-logo {
    width: 28px; height: 28px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 13px; font-weight: 700;
    background: var(--brand-grad);
}
.engine-btn > i { font-size: 11px; color: var(--text-3); }
.engine-menu {
    position: fixed; left: 0; top: 0;
    width: max-content; max-width: min(600px, calc(100vw - 20px));
    background: var(--glass-strong); backdrop-filter: blur(28px) saturate(1.8);
    border: 1px solid var(--glass-border); border-radius: 18px;
    box-shadow: var(--shadow-2); padding: 12px; z-index: 400;
    display: none; flex-wrap: nowrap; gap: 2px;
    overflow-x: auto; overflow-y: hidden;
    scrollbar-width: none; cursor: grab;
    -webkit-overflow-scrolling: touch;
}
.engine-menu.show { display: flex; animation: pop-in 0.16s var(--ease); }
.engine-menu::-webkit-scrollbar { display: none; width: 0; height: 0; }
.engine-menu.dragging { cursor: grabbing; }
.engine-item {
    width: 78px; flex-direction: column; gap: 7px;
    padding: 12px 4px 9px; border-radius: 12px; font-size: 12px;
    color: var(--text-1); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    position: relative; transition: background 0.15s;
}
.engine-item:hover { background: rgba(79,107,255,0.1); }
.engine-item.active { background: rgba(79,107,255,0.14); }
.engine-item .engine-logo { width: 42px; height: 42px; font-size: 16px; border-radius: 13px; box-shadow: 0 4px 12px rgba(0,0,0,0.14); }
.engine-item .eng-check { position: absolute; top: 5px; right: 7px; font-size: 11px; color: var(--brand); visibility: hidden; }
.engine-item.active .eng-check { visibility: visible; }
/* 图片图标（后台搜索管理配置） */
.engine-img {
    width: 100%; height: 100%; object-fit: contain;
    border-radius: inherit; display: block;
}
.engine-item .engine-img { width: 42px; height: 42px; border-radius: 13px; background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.14); padding: 4px; }
.engine-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 74px; }
#searchInput {
    flex: 1; min-width: 0; height: 100%; border: none; background: transparent;
    font-size: 15px; color: var(--text-1); padding: 0 10px;
}
#searchInput::placeholder { color: var(--text-3); }
.search-go {
    width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
    background: var(--brand-grad); color: #fff; font-size: 15px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 14px rgba(79,107,255,0.4);
    transition: transform 0.2s var(--ease), box-shadow 0.2s;
}
.search-go:hover { transform: scale(1.06); }

/* ---------- 标签区 ---------- */
.tags-section {
    width: 100%; max-width: 1060px;
    flex: 1 1 auto; min-height: 0;
    overflow-y: auto;              /* 仅标签区滚动，时钟/搜索框固定 */
    padding-bottom: 130px;         /* 底部 dock 悬浮留白 */
}
.section-head {
    display: flex; align-items: center; gap: 10px;
    color: #fff; margin: 0 4px 14px;
}
.section-head h2 { font-size: 18px; font-weight: 700; letter-spacing: 0.5px; }
/* 文件夹：返回 / 新建按钮 */
.section-head .folder-back, .section-head .folder-add {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
    background: rgba(255,255,255,0.14); color: #fff; border: none; cursor: pointer;
    font-size: 14px; transition: background 0.2s;
}
.section-head .folder-back:hover, .section-head .folder-add:hover { background: rgba(255,255,255,0.26); }
/* 标题居左，数量与新建按钮靠右 */
.section-head #catCount { margin-left: auto; }
/* ---------- 文件夹卡片：成员图标预览 ---------- */
.folder-card .fc-preview {
    flex: 1 1 auto; width: 100%; min-height: 0;
    display: grid; grid-template-columns: repeat(2, 1fr); gap: calc(6px * var(--icon-scale, 1)); align-content: stretch; justify-items: center; align-items: center;
    padding: calc(8px * var(--icon-scale, 1)); box-sizing: border-box;
}
.folder-card .fc-mini {
    width: 100%; height: 100%; min-width: 0; min-height: 0;
    border-radius: 7px; display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: calc(11px * var(--icon-scale, 1)); font-weight: 600; overflow: hidden;
}
.folder-card .fc-mini img { width: 72%; height: 72%; object-fit: contain; }
/* 2x2 文件夹：前3大图标 + 堆叠格（格子拉伸填满，不固定比例） */
.fc-p22 { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); }
.fc-p22 .fc-big, .fc-p24 .fc-big {
    width: 100%; height: 100%; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: calc(22px * var(--icon-scale, 1)); font-weight: 600; overflow: hidden;
}
.fc-p22 .fc-big img, .fc-p24 .fc-big img { width: 58%; height: 58%; object-fit: contain; }
.fc-stack { display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); gap: 3px; padding: 6px; background: rgba(255,255,255,0.14); }
.fc-stack .fc-mini { width: auto; height: auto; border-radius: 5px; font-size: calc(10px * var(--icon-scale, 1)); }
/* 2x4 文件夹：8 图标 4列2行（高度=2倍标签高，宽度=4列） */
.fc-p24 { grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(2, 1fr); }
/* 文件夹打开面板 */
.fp-mask {
    position: fixed; inset: 0; z-index: 520;
    background: rgba(8,10,24,0.45);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.2s;
}
.fp-mask.show { opacity: 1; }
.fp-panel {
    position: relative; width: min(480px, 92vw); max-height: 72vh; overflow-y: auto;
    border-radius: 24px; background: var(--glass, rgba(30,34,52,0.72));
    backdrop-filter: blur(28px) saturate(1.7); -webkit-backdrop-filter: blur(28px) saturate(1.7);
    border: 1px solid var(--glass-border, rgba(255,255,255,0.16));
    box-shadow: var(--shadow-2, 0 24px 64px rgba(0,0,0,0.4));
    padding: 30px 24px 18px;
    transform: scale(0.92); transition: transform 0.2s;
}
.fp-mask.show .fp-panel { transform: scale(1); }
.fp-close {
    position: absolute; top: 12px; right: 12px;
    width: 28px; height: 28px; border-radius: 9px; border: none; cursor: pointer;
    background: rgba(255,255,255,0.14); color: #fff; font-size: 12px;
    display: flex; align-items: center; justify-content: center;
}
.fp-close:hover { background: rgba(255,255,255,0.26); }
.fp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; justify-items: center; }
.fp-item { cursor: pointer; transition: transform 0.2s var(--ease, ease); }
.fp-item:hover { transform: translateY(-3px) scale(1.06); }
.fp-icon {
    width: 56px; height: 56px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 22px; font-weight: 600; overflow: hidden;
    box-shadow: 0 6px 16px rgba(0,0,0,0.16);
}
.fp-icon img { width: 62%; height: 62%; object-fit: contain; border-radius: 4px; }
.fp-name { text-align: center; color: #fff; font-weight: 600; font-size: 14px; margin-top: 18px; }
.fp-empty { grid-column: 1 / -1; text-align: center; color: rgba(255,255,255,0.7); font-size: 13px; padding: 24px 0; }
/* 拖拽状态 */
.tag-card.dragging { opacity: 0.45; transform: scale(0.96); }
/* 指针拖拽（安卓桌面式）：原卡半透明 + 跟手虚影 */
.tag-card.dnd-src { opacity: 0.35; }
.tag-card.dnd-ghost {
    position: fixed; z-index: 1200; margin: 0;
    pointer-events: none; opacity: 0.95; transform: scale(1.05);
    box-shadow: 0 18px 44px rgba(0,0,0,0.3);
}
.folder-card.drag-over { transform: scale(1.04); border-color: #4f9cff !important; box-shadow: 0 0 0 3px rgba(79,156,255,0.35); }
.section-head span { font-size: 12.5px; color: rgba(255,255,255,0.65); }

.tags-grid {
    /* 安卓桌面式网格：1格=1个普通标签（宽52px*s，高52px*s+34），dense 自动回填大卡旁空格 */
    display: grid;
    grid-template-columns: repeat(auto-fill, calc(52px * var(--icon-scale)));
    grid-auto-rows: calc(52px * var(--icon-scale) + 34px);
    grid-auto-flow: dense;
    gap: 14px var(--tag-gap, 10px);
}
/* 图标最大列数：固定列数；列表宽度按列数精确计算（首个标签距左15px、末个距右15px） */
body.tag-fixed-cols .tags-grid { grid-template-columns: repeat(var(--tag-cols), calc(52px * var(--icon-scale))); }
body.tag-fixed-cols .tags-section { max-width: none; width: fit-content; }
body.tag-fixed-cols .tags-grid {
    width: calc(var(--tag-cols) * (52px * var(--icon-scale)) + (var(--tag-cols) - 1) * var(--tag-gap, 10px) + 30px);
    padding-left: 15px; padding-right: 15px;
}
.tag-card {
    position: relative;
    min-width: 0; min-height: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    cursor: pointer; overflow: visible;
    transition: transform 0.25s var(--ease);
}
.tag-card:hover { transform: scale(1.06); }
.tag-card:active { transform: scale(0.98); }
/* 布局尺寸（"高x宽"；1x2=高1个图标高、宽2格，其余按格跨越） */
.gs-1x2 { grid-column: span 2; height: calc(52px * var(--icon-scale)); align-self: start; }
.gs-2x1 { grid-row: span 2; }
.gs-2x2 { grid-column: span 2; grid-row: span 2; }
.gs-2x4 { grid-column: span 4; grid-row: span 2; }
/* 文件夹卡 / 卡片组件：玻璃底卡面（大卡按格跨越铺满） */
.tag-card.folder-card, .tag-card.widget-card {
    justify-content: center;
    background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    backdrop-filter: blur(28px) saturate(1.7); -webkit-backdrop-filter: blur(28px) saturate(1.7);
}
/* 1x1 文件夹：卡面高度=图标区（与普通标签图标同高同底），名称悬浮卡外 */
.tag-card.folder-card.gs-1x1 {
    height: calc(52px * var(--icon-scale));
    align-self: start;
}
/* 组件卡 = 普通标签几何：卡面高度=跨行高-34px名称区，卡面底=最后一行图标底 */
.tag-card.widget-holder .widget-card { flex: none; height: calc(100% - 34px); min-height: 0; }
.tag-card.folder-card:hover, .tag-card.widget-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); }
/* 文件夹大卡名称：卡内底部，与最底行普通标签名称线对齐 */
.tag-card.folder-card .tag-name {
    position: static; transform: none; text-shadow: none; pointer-events: auto; max-width: 92%;
    margin-bottom: 4px;
}
/* 文件夹 1x1 名称：悬浮在卡面下方，与普通标签名称同一水平线 */
.tag-card.folder-card.gs-1x1 .tag-name {
    position: absolute; left: 50%; top: calc(100% + 12px);
    transform: translateX(-50%);
    max-width: none; white-space: nowrap;
    text-shadow: 0 1px 8px rgba(0,0,0,0.5);
    pointer-events: none;
    margin-bottom: 0;
}
/* 组件卡名称：悬浮卡面下方 12px，与最后一行普通标签名称同线（等同普通标签） */
.tag-card.widget-holder .tag-name {
    position: absolute; left: 50%; top: calc(100% - 22px); transform: translateX(-50%);
    max-width: none; white-space: nowrap;
    text-shadow: 0 1px 8px rgba(0,0,0,0.5);
    pointer-events: none; margin: 0;
}
/* 普通标签 / 添加标签卡：名称悬浮在图标下方（不占宽度，行高=图标+34px） */
.tags-grid > .tag-card:not(.folder-card):not(.widget-card):not(.widget-holder) .tag-name {
    position: absolute; left: 50%; top: calc(52px * var(--icon-scale) + 12px);
    transform: translateX(-50%);
    max-width: none; white-space: nowrap;
    text-shadow: 0 1px 8px rgba(0,0,0,0.5);
    pointer-events: none;
}
/* 大布局（1x2/2x1/2x2/2x4）普通标签：图标随布局放大填满卡片，名称悬浮卡底 */
.tags-grid > .tag-card:not(.folder-card):not(.widget-card):not(.gs-1x1) .tag-icon {
    width: 100%; height: auto; flex: 1 1 auto; min-height: 0;
}
.tags-grid > .tag-card:not(.folder-card):not(.widget-card):not(.gs-1x1) .tag-icon img {
    width: 100%; height: 100%; object-fit: fill; border-radius: inherit;
}
.tags-grid > .tag-card:not(.folder-card):not(.widget-card):not(.widget-holder):not(.gs-1x1) .tag-name {
    top: auto; bottom: 6px;
}

.tag-icon {
    width: calc(52px * var(--icon-scale)); height: calc(52px * var(--icon-scale));
    border-radius: calc(var(--tag-radius, 15px) * var(--icon-scale));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: calc(21px * var(--icon-scale)); font-weight: 600;
    box-shadow: 0 6px 16px rgba(0,0,0,0.16);
    overflow: hidden; flex-shrink: 0;
    transition: transform 0.25s var(--ease);
}
.tag-card:hover .tag-icon { transform: scale(1.08); }
.tag-icon img { width: 62%; height: 62%; object-fit: contain; border-radius: 4px; }
/* 上传图片图标：仅显示图片本身（无背景色/投影），图片铺满图标区，圆角随图标区裁切 */
.tag-icon.icon-img { background: transparent !important; box-shadow: none; }
.tag-icon.icon-img img { width: 100%; height: 100%; object-fit: contain; border-radius: 0; }
.tag-icon.icon-img span { text-shadow: 0 1px 8px rgba(0,0,0,0.4); }
/* 图标背景关闭：仅显示字符（覆盖行内背景色） */
body.tag-icon-plain .tag-icon { background: transparent !important; box-shadow: none; text-shadow: 0 1px 8px rgba(0,0,0,0.35); }
.tag-name {
    font-size: 12.5px; color: var(--tag-font-color, var(--text-1)); max-width: 92%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-weight: 500;
}
.tag-actions {
    position: absolute; top: 7px; right: 7px; display: flex; gap: 4px;
    opacity: 0; transition: opacity 0.2s;
}
.tag-card:hover .tag-actions { opacity: 1; }
.tag-actions span {
    width: 22px; height: 22px; border-radius: 7px;
    background: rgba(255,255,255,0.85); color: var(--text-2);
    display: flex; align-items: center; justify-content: center; font-size: 11px;
    transition: all 0.15s;
}
.tag-actions span:hover { background: var(--brand); color: #fff; }
.tag-add {
    width: calc(52px * var(--icon-scale)); height: calc(52px * var(--icon-scale));
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; flex-shrink: 0;
}
.tag-add img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- Dock 栏 ---------- */
.dock-wrap {
    position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
    z-index: 95;
}
.dock {
    display: flex; align-items: flex-end; gap: 8px;
    padding: 9px 12px; border-radius: 22px;
    background-color: var(--chrome-bg, rgba(255,255,255,0.24));
    backdrop-filter: blur(32px) saturate(1.8);
    -webkit-backdrop-filter: blur(32px) saturate(1.8);
    border: 1px solid rgba(255,255,255,0.4);
    box-shadow: var(--shadow-2);
    max-width: 86vw; overflow-x: auto;
}
.dock-item {
    width: 46px; height: 46px; border-radius: 13px; flex-shrink: 0;
    background: rgba(255,255,255,0.9); color: var(--text-1);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; cursor: pointer; position: relative;
    box-shadow: var(--shadow-1);
    transition: transform 0.22s var(--ease), background 0.2s;
}
.dock-item:hover { transform: translateY(-7px) scale(1.1); background: #fff; }
.dock-item .di-img { width: 60%; height: 60%; object-fit: contain; }
.dock-item .di-dot {
    position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
    width: 4px; height: 4px; border-radius: 50%; background: rgba(255,255,255,0.9);
}
.dock-divider { width: 1px; height: 38px; background: rgba(255,255,255,0.35); margin: 0 3px; flex-shrink: 0; }
.dock-item.sys { background: rgba(255,255,255,0.28); color: #fff; }
.dock-item.sys:hover { background: rgba(255,255,255,0.4); }

/* ---------- 右键菜单 ---------- */
.ctx-menu {
    position: fixed; z-index: 1000; min-width: 200px;
    background: rgba(250, 250, 252, 0.82);
    backdrop-filter: blur(32px) saturate(1.9);
    -webkit-backdrop-filter: blur(32px) saturate(1.9);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: 16px; box-shadow: var(--shadow-3);
    padding: 6px; display: none;
    animation: pop-in 0.15s var(--ease);
}
.ctx-menu.show { display: block; }
.ctx-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8.5px 11px; border-radius: 10px;
    font-size: 13.5px; color: var(--text-1); cursor: pointer; position: relative;
    user-select: none;
}
.ctx-item:hover { background: var(--brand); color: #fff; }
.ctx-item:hover i { color: #fff; }
.ctx-item i { font-size: 14.5px; width: 18px; color: var(--text-2); }
.ctx-item.danger { color: var(--danger); }
.ctx-item.danger i { color: var(--danger); }
.ctx-item.danger:hover { background: var(--danger); color: #fff; }
.ctx-item.danger:hover i { color: #fff; }
.ctx-item .ctx-arrow { margin-left: auto; font-size: 11px; color: var(--text-3); }
.ctx-item:hover .ctx-arrow { color: rgba(255,255,255,0.8); }
.ctx-div { height: 1px; background: var(--line); margin: 5px 9px; }
/* 子菜单 */
.ctx-sub {
    position: absolute; left: calc(100% + 8px); top: -7px; min-width: 168px;
    background: rgba(250, 250, 252, 0.86);
    backdrop-filter: blur(32px) saturate(1.9);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: 14px; box-shadow: var(--shadow-3);
    padding: 6px; display: none;
}
/* hover 桥：覆盖主项与子菜单间的空隙，防止鼠标滑过时 :hover 断开导致子菜单消失 */
.ctx-sub::before {
    content: ''; position: absolute; left: -12px; top: 0;
    width: 12px; height: 100%;
}
/* 屏幕右缘放不下时子菜单翻转到左侧 */
.ctx-menu.flip .ctx-sub { left: auto; right: calc(100% + 8px); }
.ctx-menu.flip .ctx-sub::before { left: auto; right: -12px; }
.ctx-item.has-sub:hover > .ctx-sub { display: block; }
/* 布局胶囊组 */
.ctx-capsules {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px;
}
.ctx-capsule {
    padding: 7px 0; border-radius: 9px; text-align: center;
    font-size: 12.5px; font-weight: 600; color: var(--text-2);
    background: rgba(28,31,39,0.05); border: 1.5px solid transparent; cursor: pointer;
    transition: all 0.15s;
}
.ctx-capsule:hover { border-color: var(--brand); color: var(--brand); }
.ctx-capsule.active { background: var(--brand-grad); color: #fff; box-shadow: 0 3px 10px rgba(79,107,255,0.4); }
.ctx-label {
    font-size: 11px; color: var(--text-3); padding: 7px 12px 3px; letter-spacing: 1px;
}

/* ---------- 首页登录/注册弹窗 ---------- */
.login-card {
    width: min(392px, calc(100vw - 40px));
    background: #fff; border-radius: 22px;
    padding: 30px 30px 24px; position: relative;
    box-shadow: 0 24px 70px rgba(20,24,40,0.30);
    animation: pop-in 0.22s var(--ease);
}
.login-x {
    position: absolute; top: 16px; right: 16px;
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #9aa1ae; font-size: 15px; transition: all 0.15s;
}
.login-x:hover { background: #f1f3f8; color: #1c1f27; }
.login-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.login-logo {
    width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0;
    background: var(--brand-grad); color: #fff; font-size: 20px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 20px rgba(79,107,255,0.4);
}
.login-head h3 { font-size: 17.5px; font-weight: 800; color: #1c1f27; }
.login-field { margin-bottom: 14px; }
.login-field .form-label { font-size: 12.5px; color: #5b6270; margin-bottom: 6px; display: block; }
.login-input {
    width: 100%; height: 46px; border-radius: 12px;
    background: #f5f6fa; border: 1.5px solid #eceef5;
    padding: 0 14px; font-size: 14px; color: #1c1f27; outline: none;
    transition: all 0.18s;
}
.login-input:focus {
    border-color: var(--brand); background: #fff;
    box-shadow: 0 0 0 3px rgba(79,107,255,0.14);
}
.login-input::placeholder { color: #b3b9c6; }
.login-btn {
    width: 100%; height: 47px; border: none; border-radius: 12px;
    background: var(--brand-grad); color: #fff; font-size: 15px; font-weight: 700;
    letter-spacing: 4px; cursor: pointer; margin-top: 6px;
    box-shadow: 0 8px 20px rgba(79,107,255,0.35);
    transition: all 0.2s;
}
.login-btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.login-btn:disabled { opacity: 0.6; cursor: default; transform: none; }
.login-err {
    display: none; margin: 10px 0 0; padding: 9px 12px;
    background: #fff1f0; color: #e5484d; border-radius: 10px;
    font-size: 12.5px; line-height: 1.5;
}
.login-err.show { display: block; animation: pop-in 0.18s var(--ease); }
.login-foot {
    margin-top: 18px; padding-top: 16px; border-top: 1px solid #f1f3f8;
    text-align: center; font-size: 13px; color: #9aa1ae;
}
.login-foot a { color: var(--brand); font-weight: 600; cursor: pointer; }
.login-foot a:hover { text-decoration: underline; }

/* ---------- 通用弹窗 ---------- */
.modal-mask {
    position: fixed; inset: 0; z-index: 500;
    background: rgba(10, 12, 26, 0.42);
    backdrop-filter: blur(6px);
    display: none; align-items: center; justify-content: center;
    padding: 24px;
}
.modal-mask.show { display: flex; animation: fade-in 0.2s; }
/* 无笼罩层弹窗：遮罩透明，仅保留点外部关闭与居中 */
#settingsModal.modal-mask, #tagModal.modal-mask {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.modal-panel {
    width: min(560px, 100%); max-height: min(86vh, 780px);
    background: var(--glass-strong); backdrop-filter: blur(36px) saturate(1.8);
    -webkit-backdrop-filter: blur(36px) saturate(1.8);
    border: 1px solid var(--glass-border); border-radius: 22px;
    box-shadow: var(--shadow-3);
    display: flex; flex-direction: column; overflow: hidden;
    animation: panel-in 0.28s var(--ease);
}
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px 14px; flex-shrink: 0;
}
.modal-head h3 { font-size: 16.5px; font-weight: 700; }
.modal-close {
    width: 30px; height: 30px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-3); font-size: 15px; transition: all 0.15s;
}
.modal-close:hover { background: rgba(28,31,39,0.07); color: var(--text-1); }
.modal-body { padding: 4px 22px 20px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-footer {
    padding: 12px 22px 18px; flex-shrink: 0;
    display: flex; gap: 10px; justify-content: flex-end;
}

/* 按钮 */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 40px; padding: 0 18px; border-radius: 12px;
    font-size: 14px; font-weight: 600; cursor: pointer;
    transition: all 0.2s var(--ease);
}
.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: 0 6px 18px rgba(79,107,255,0.35); }
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-ghost { background: rgba(28,31,39,0.06); color: var(--text-1); }
.btn-ghost:hover { background: rgba(28,31,39,0.1); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-block { width: 100%; }
.btn-sm { height: 32px; padding: 0 13px; font-size: 12.5px; border-radius: 9px; }

/* 表单 */
.form-item { margin-bottom: 15px; }
.form-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.form-input, .form-select {
    width: 100%; height: 42px; padding: 0 13px;
    border: 1.5px solid var(--line); border-radius: 12px;
    background: rgba(255,255,255,0.7); font-size: 14px; color: var(--text-1);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus, .form-select:focus { border-color: var(--brand); box-shadow: var(--ring); }
.form-row { display: flex; gap: 10px; }
.form-row > * { flex: 1; }
.form-hint { font-size: 11.5px; color: var(--text-3); margin-top: 6px; }

/* 分段 Tab */
.seg-tabs {
    display: flex; gap: 4px; background: rgba(28,31,39,0.06);
    padding: 4px; border-radius: 12px; margin-bottom: 18px;
}
.seg-tab {
    flex: 1; height: 34px; border-radius: 9px;
    font-size: 13px; font-weight: 600; color: var(--text-2);
    display: flex; align-items: center; justify-content: center; gap: 6px;
    cursor: pointer; transition: all 0.2s var(--ease);
}
.seg-tab.active { background: #fff; color: var(--text-1); box-shadow: var(--shadow-1); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade-in 0.2s; }

/* 系统标签库 */
.sys-search { position: relative; margin-bottom: 12px; }
.sys-search i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.sys-search input { padding-left: 36px; }
/* 添加标签弹窗：PC 端尽量 1500px 宽，屏幕变小自适应（遮罩自带 24px 内边距） */
#tagModal .modal-panel { width: min(1200px, 76%); max-height: min(70vh, 760px); }
#tagModal .seg-tabs { max-width: 460px; }
.system-tags { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; padding-right: 2px; }
.system-tag-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; border-radius: 13px; cursor: pointer;
    background: rgba(255,255,255,0.6); border: 1.5px solid transparent;
    transition: all 0.2s var(--ease);
}
.system-tag-item:hover { border-color: var(--brand); background: #fff; transform: translateY(-1px); }
.sti-icon {
    width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 15px; font-weight: 700;
}
.sti-info { flex: 1; min-width: 0; }
.sti-name { font-size: 13px; font-weight: 600; }
.sti-desc { font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sti-btn { font-size: 11.5px; font-weight: 600; color: var(--brand); flex-shrink: 0; }
.sti-btn.added { color: var(--success); }

/* 组件选择列表 */
.widget-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.widget-item {
    padding: 14px 8px; border-radius: 14px; text-align: center; cursor: pointer;
    background: rgba(255,255,255,0.6); border: 1.5px solid transparent;
    transition: all 0.2s var(--ease);
}
.widget-item:hover { border-color: var(--brand); background: #fff; transform: translateY(-2px); }
.widget-item .w-icon {
    width: 42px; height: 42px; margin: 0 auto 8px; border-radius: 13px;
    background: var(--brand-grad); display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}
.widget-item .w-name { font-size: 12.5px; font-weight: 600; }
.widget-item .w-desc { font-size: 10.5px; color: var(--text-3); margin-top: 2px; }

/* 图标选择 */
.icon-pick-row { display: flex; align-items: center; gap: 12px; }
.icon-pick-row .form-input { flex: 1; }
.color-picker { display: flex; flex-wrap: wrap; gap: 9px; }
.color-item {
    width: 30px; height: 30px; border-radius: 9px; cursor: pointer;
    border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
    transition: transform 0.15s var(--ease);
    position: relative;
}
.color-item:hover { transform: scale(1.12); }
.color-item.selected { border-color: var(--text-1); transform: scale(1.1); }
.color-item.selected::after {
    content: '✓'; position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 13px; font-weight: 700;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.icon-preview { display: flex; justify-content: center; padding: 8px 0 2px; }
.preview-box {
    width: 58px; height: 58px; border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 20px; font-weight: 600;
    box-shadow: 0 8px 20px rgba(0,0,0,0.18); overflow: hidden;
}
.preview-box img { width: 62%; height: 62%; object-fit: contain; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl {
    position: absolute; inset: 0; border-radius: 999px;
    background: rgba(28,31,39,0.18); transition: background 0.25s;
}
.switch .sl::before {
    content: ''; position: absolute; top: 3px; left: 3px;
    width: 20px; height: 20px; border-radius: 50%; background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    transition: transform 0.25s var(--ease);
}
.switch input:checked + .sl { background: var(--success); }
.switch input:checked + .sl::before { transform: translateX(18px); }

/* 滑块 */
.slider-row { display: flex; align-items: center; gap: 12px; }
input[type="range"].slider {
    flex: 1; -webkit-appearance: none; height: 5px; border-radius: 3px;
    background: rgba(28,31,39,0.14); outline: none;
}
input[type="range"].slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 19px; height: 19px; border-radius: 50%;
    background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.3), 0 0 0 1.5px var(--brand);
    cursor: pointer; transition: transform 0.15s;
}
input[type="range"].slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.slider-val { font-size: 12.5px; font-weight: 600; color: var(--brand); min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 设置中心 ---------- */
.settings-panel { width: min(960px, 100%); height: min(640px, 88vh); }
.settings-wrap { display: flex; gap: 18px; height: 100%; min-height: 0; }
.settings-nav {
    width: 230px; flex-shrink: 0; display: flex; flex-direction: column; gap: 3px;
    padding-right: 14px; border-right: 1px solid var(--line);
    overflow-y: auto;
}
.sn-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 13px; border-radius: 11px;
    font-size: 13.5px; font-weight: 500; color: var(--text-2);
    cursor: pointer; transition: all 0.18s var(--ease);
}
.sn-item:hover { background: rgba(79,107,255,0.08); color: var(--brand); }
.sn-item.active { background: var(--brand-grad); color: #fff; font-weight: 600; box-shadow: 0 5px 14px rgba(79,107,255,0.35); }
/* 侧栏顶部用户卡片 */
.sn-user {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; margin-bottom: 8px;
    background: rgba(79,107,255,0.06); border: 1px solid rgba(79,107,255,0.14);
    border-radius: 13px; flex-shrink: 0;
}
.sn-user.clickable { cursor: pointer; transition: all 0.18s var(--ease); }
.sn-user.clickable:hover { background: rgba(79,107,255,0.12); transform: translateY(-1px); }
.sn-avatar {
    width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
    color: #fff; font-size: 16px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.sn-uinfo { min-width: 0; flex: 1; }
.sn-uname { font-size: 13.5px; font-weight: 700; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sn-usub { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.sn-uarrow { font-size: 12px; color: var(--text-3); }
/* 未登录登录提示卡 */
.login-tip-card {
    background: #eaf3ff; border: 1px solid #d3e6ff; border-radius: 13px;
    padding: 16px 14px; text-align: center; margin-bottom: 12px;
}
.lt-title { font-size: 13.5px; font-weight: 700; color: #2f7bf6; }
.lt-sub { font-size: 12px; color: #6d9df0; margin-top: 4px; }
.lt-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; margin-bottom: 10px;
    background: #f7f8fb; border-radius: 13px;
    font-size: 13.5px; font-weight: 600; color: var(--text-1);
    cursor: pointer; transition: all 0.18s var(--ease);
}
.lt-row:hover { background: #eef1f7; }
.lt-row i { font-size: 12px; color: var(--text-3); }
.lt-row#ltLoginRow { background: linear-gradient(135deg,#3d9bff,#2f7bf6); color: #fff; }
.lt-row#ltLoginRow:hover { filter: brightness(1.06); }
.lt-row#ltLoginRow i { color: rgba(255,255,255,0.85); }
.sn-item i { font-size: 15.5px; }
.settings-body { flex: 1 1 auto; min-width: 0; overflow-y: auto; padding-right: 4px; }
.set-section { display: none; }
.set-section.active { display: block; animation: fade-in 0.2s; }
.set-row {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 13px 15px; border-radius: 13px; margin-bottom: 8px;
    background: rgba(255,255,255,0.55); border: 1px solid rgba(255,255,255,0.6);
}
.set-row .sr-info { flex: 1; min-width: 0; }
.set-row .sr-title { font-size: 13.5px; font-weight: 600; }

.sr-desc { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

.set-row .sr-desc { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.set-card {
    padding: 15px; border-radius: 13px; margin-bottom: 10px;
    background: rgba(255,255,255,0.55); border: 1px solid rgba(255,255,255,0.6);
}
.set-card .sc-title { font-size: 13px; font-weight: 700; margin-bottom: 11px; }

/* 壁纸预览与预设 */
.wp-preview {
    height: 190px; border-radius: 14px; margin-bottom: 12px;
    background-size: cover; background-position: center;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5), var(--shadow-1);
    position: relative; overflow: hidden;
}
.wp-btns { display: flex; gap: 10px; margin-bottom: 12px; }
.wp-btns .btn { flex: 1; }
/* 分区组标题 */
.sg-title { font-size: 14.5px; font-weight: 800; margin: 18px 2px 10px; }
.set-section .sg-title:first-child { margin-top: 2px; }
.wp-preset-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.wp-preset {
    height: 52px; border-radius: 11px; cursor: pointer;
    border: 2px solid transparent; transition: all 0.18s;
    background-size: cover; background-position: center;
}
.wp-preset:hover { transform: translateY(-2px); }
.wp-preset.active { border-color: var(--brand); box-shadow: var(--ring); }

/* ---------- 壁纸选择弹窗 ---------- */
#wpModal .wp-panel { width: min(1020px, 96%); height: min(680px, 90vh); }
#wpModal .modal-body { overflow: hidden; }
.wp-body { display: flex; gap: 16px; height: 100%; min-height: 0; }
.wp-side {
    width: 150px; flex-shrink: 0;
    display: flex; flex-direction: column; gap: 4px;
    padding: 4px 0;
}
.wp-side-item {
    padding: 10px 13px; border-radius: 10px;
    font-size: 13.5px; font-weight: 600; color: var(--text-2);
    cursor: pointer; transition: all 0.18s var(--ease);
    white-space: nowrap;
}
.wp-side-item i { margin-right: 3px; font-size: 13px; }
.wp-side-item:hover { background: rgba(28,31,39,0.06); color: var(--text-1); }
.wp-side-item.active { background: #2b2f3a; color: #fff; }
.wp-side-flex { flex: 1 1 auto; }
.wp-main { flex: 1 1 auto; min-width: 0; overflow-y: auto; padding: 2px 2px 8px 0; }
.wp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.wp-item {
    position: relative; aspect-ratio: 16 / 9;
    border-radius: 12px; overflow: hidden; cursor: pointer;
    background-size: cover; background-position: center;
    box-shadow: var(--shadow-1);
    transition: transform 0.18s var(--ease), box-shadow 0.18s;
}
.wp-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.wp-item.active { box-shadow: 0 0 0 3px var(--brand), var(--shadow-2); }
.wp-check { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; }
.wp-item.active .wp-check { display: flex; }
.wp-check i {
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(0,0,0,0.45); color: #fff; font-size: 24px;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.wp-custom { padding: 6px 4px; }
.wc-title { font-size: 15px; font-weight: 700; }
.wc-sub { font-size: 12.5px; color: var(--text-2); margin: 6px 0 14px; }
.wp-url-row { display: flex; gap: 10px; margin-bottom: 12px; }
.wp-url-row .form-input { flex: 1 1 auto; }
.wp-url-row .btn { flex-shrink: 0; }

/* ---------- 自定义取色弹窗（无遮罩浮层） ---------- */
.cp-float { position: fixed; inset: 0; z-index: 580; display: none; pointer-events: none; }
.cp-float.show { display: block; }
.cp-float .cp-panel {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    pointer-events: auto; animation: cp-pop 0.18s var(--ease);
}
@keyframes cp-pop {
    from { opacity: 0; transform: translate(-50%,-50%) scale(0.94); }
    to   { opacity: 1; transform: translate(-50%,-50%) scale(1); }
}
#cpModal .cp-panel { width: min(340px, 100%); }
.cp-area {
    position: relative; width: 100%; height: 180px;
    border-radius: 12px; overflow: hidden; cursor: crosshair;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
    touch-action: none;
}
.cp-cursor {
    position: absolute; width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid #fff; box-shadow: 0 0 0 1.5px rgba(0,0,0,0.45);
    transform: translate(-50%,-50%); pointer-events: none;
}
.cp-row { display: flex; align-items: center; gap: 10px; margin: 14px 0 10px; }
.cp-cur { width: 30px; height: 30px; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12); }
.cp-hue {
    flex: 1; -webkit-appearance: none; appearance: none;
    height: 12px; border-radius: 999px; cursor: pointer;
    background: linear-gradient(to right,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00);
}
.cp-hue::-webkit-slider-thumb {
    -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.45); cursor: pointer;
}
.cp-alpha {
    -webkit-appearance: none; appearance: none;
    display: block; width: 100%; height: 14px; border-radius: 999px;
    cursor: pointer; margin: 0 0 10px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.cp-alpha::-webkit-slider-thumb {
    -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.45); cursor: pointer;
}
/* 当前颜色圆点：棋盘格打底，透明色也可见 */
.cp-cur {
    background-image: repeating-conic-gradient(#d9d9de 0% 25%, #ffffff 0% 50%);
    background-size: 10px 10px;
}
.cp-hex { height: 38px; font-size: 13px; }
.cp-presets { display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px; margin-top: 12px; }
.cp-presets .color-dot { width: 100%; aspect-ratio: 1; border-radius: 6px; }

/* 时间日期预览（深色时钟卡） */
.clock-preview {
    background: #1c1c1e; border-radius: 16px; padding: 24px;
    text-align: center; color: #fff; margin-bottom: 12px;
}
.clock-preview .cp-time { font-size: 40px; font-weight: 200; font-variant-numeric: tabular-nums; }
.clock-preview .cp-date { font-size: 12.5px; margin-top: 5px; opacity: 0.85; }
.color-dots { display: flex; gap: 8px; flex-wrap: wrap; }
.color-dot {
    width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
    border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}
.color-dot.active { border-color: var(--text-1); transform: scale(1.12); }

/* 日志列表 */
.log-list { display: flex; flex-direction: column; gap: 7px; }
.log-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 13px; border-radius: 11px; font-size: 12.5px;
    background: rgba(255,255,255,0.55); border: 1px solid rgba(255,255,255,0.6);
}
.log-item .lg-act { font-weight: 700; color: var(--brand); flex-shrink: 0; }
.log-item .lg-txt { flex: 1; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-item .lg-time { color: var(--text-3); font-size: 11px; flex-shrink: 0; }

/* ---------- 组件编辑弹窗（macOS 深色） ---------- */
.we-panel {
    width: min(760px, 100%); height: min(560px, 90vh);
    background: #1c1c1e; border-radius: 22px;
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: var(--shadow-3); color: #f5f5f7;
    display: flex; flex-direction: column; overflow: hidden;
    animation: panel-in 0.28s var(--ease);
}
.we-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 17px 22px 13px; flex-shrink: 0;
}
.we-head h3 { font-size: 16px; font-weight: 700; }
.we-close {
    width: 28px; height: 28px; border-radius: 50%; color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center;
    font-size: 13px; transition: all 0.15s;
}
.we-close:hover { background: rgba(255,255,255,0.2); color: #fff; }
.we-wrap { display: flex; gap: 22px; flex: 1 1 auto; min-height: 0; padding: 2px 22px 20px; }
.we-form { width: 315px; flex-shrink: 0; overflow-y: auto; padding-right: 4px; }
.we-preview-area {
    flex: 1 1 auto; min-width: 0; border-radius: 16px;
    background: rgba(255,255,255,0.05);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.we-field { margin-bottom: 14px; }
.we-label { display: block; font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.55); margin-bottom: 7px; letter-spacing: 0.5px; }
.we-input, .we-select {
    width: 100%; height: 40px; padding: 0 12px;
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14);
    border-radius: 11px; color: #f5f5f7; font-size: 13.5px;
    transition: border-color 0.2s, background 0.2s;
    color-scheme: dark;
}
.we-input:focus, .we-select:focus { border-color: var(--brand); background: rgba(255,255,255,0.12); }
.we-input::placeholder { color: rgba(255,255,255,0.3); }
.we-select option { background: #1c1c1e; }
.we-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.we-swatch {
    width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
    border: 2px solid transparent; transition: transform 0.15s;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
}
.we-swatch:hover { transform: scale(1.15); }
.we-swatch.active { border-color: #fff; transform: scale(1.12); }
.we-bg-tabs { display: flex; gap: 4px; background: rgba(255,255,255,0.07); padding: 3px; border-radius: 10px; margin-bottom: 10px; }
.we-bg-tab { flex: 1; height: 30px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: rgba(255,255,255,0.55); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; }
.we-bg-tab.active { background: rgba(255,255,255,0.14); color: #fff; }
.we-bg-panel { display: none; }
.we-bg-panel.active { display: block; animation: fade-in 0.2s; }
.we-preset-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.we-preset {
    height: 46px; border-radius: 10px; cursor: pointer;
    border: 2px solid transparent; background-size: cover; background-position: center;
    transition: transform 0.15s;
}
.we-preset:hover { transform: translateY(-2px); }
.we-preset.active { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,0.25); }
.we-upload {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    margin-top: 9px; height: 38px; border-radius: 10px;
    border: 1.5px dashed rgba(255,255,255,0.25); color: rgba(255,255,255,0.6);
    font-size: 12.5px; cursor: pointer; width: 100%; transition: all 0.2s;
}
.we-upload:hover { border-color: rgba(255,255,255,0.5); color: #fff; }
.we-save {
    width: 100%; height: 44px; margin-top: 6px; border-radius: 12px;
    background: #0a84ff; color: #fff; font-size: 14.5px; font-weight: 700;
    transition: all 0.2s var(--ease); box-shadow: 0 6px 18px rgba(10,132,255,0.35);
}
.we-save:hover { filter: brightness(1.1); transform: translateY(-1px); }
.we-save:active { transform: scale(0.98); }

/* 预览卡（倒计时/纪念日） */
.wg-cd {
    width: 100%; height: 100%; min-height: 104px;
    border-radius: 20px;
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px; text-align: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.22);
    background-size: cover; background-position: center;
}
.we-preview-area .wg-cd { width: 230px; height: 230px; border-radius: 26px; box-shadow: 0 18px 44px rgba(0,0,0,0.5); }
.wg-cd-mask { position: absolute; inset: 0; background: #000; }
.wg-cd-name { position: relative; font-size: 13.5px; font-weight: 600; opacity: 0.92; letter-spacing: 1px; max-width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.we-preview-area .wg-cd-name { font-size: 14px; }
.wg-cd-num { position: relative; font-size: 44px; font-weight: 200; line-height: 1; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 5px; }
.we-preview-area .wg-cd-num { font-size: 64px; }
.wg-cd-num span { font-size: 15px; font-weight: 400; opacity: 0.85; }
.we-preview-area .wg-cd-num span { font-size: 17px; }
.wg-cd-sub { position: relative; font-size: 10.5px; opacity: 0.7; margin-top: 3px; max-width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.we-preview-area .wg-cd-sub { font-size: 11.5px; }

/* 网格里纪念日表盘 */
.tag-card .wg-clock { width: 56px; height: 56px; }
.tag-card .wg-clock .h-h { height: 16px; width: 3px; margin-left: -1.5px; }
.tag-card .wg-clock .h-m { height: 21px; width: 2px; margin-left: -1px; }
.tag-card .wg-clock .h-s { height: 23px; }
.tag-card .wg-clock .c-tick { transform-origin: 50% 24px; }
.we-preview-area .wg-clock { width: 92px; height: 92px; }
.we-preview-area .wg-clock .h-h { height: 26px; width: 4px; margin-left: -2px; }
.we-preview-area .wg-clock .h-m { height: 34px; width: 3px; margin-left: -1.5px; }
.we-preview-area .wg-clock .h-s { height: 37px; }
.we-preview-area .wg-clock .c-tick { transform-origin: 50% 42px; }

/* 表盘时钟（纪念日预览） */
.wg-clock {
    position: relative; width: 92px; height: 92px; margin: 8px 0 2px;
    border-radius: 50%; background: rgba(255,255,255,0.14);
    border: 2.5px solid rgba(255,255,255,0.75);
    backdrop-filter: blur(4px);
}
.wg-clock .hand { position: absolute; left: 50%; bottom: 50%; transform-origin: 50% 100%; border-radius: 4px; }
.wg-clock .h-h { width: 4px; height: 26px; margin-left: -2px; background: #fff; }
.wg-clock .h-m { width: 3px; height: 34px; margin-left: -1.5px; background: #fff; }
.wg-clock .h-s { width: 1.5px; height: 37px; margin-left: -0.75px; background: #ff453a; }
.wg-clock .c-center {
    position: absolute; top: 50%; left: 50%; width: 7px; height: 7px;
    margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: #fff;
}
.wg-clock .c-tick { position: absolute; left: 50%; top: 4px; width: 1.5px; height: 5px; margin-left: -0.75px; background: rgba(255,255,255,0.6); transform-origin: 50% 42px; }

/* 内嵌窗口 */
.embed-panel { width: min(1080px, 96vw); height: 88vh; }
.embed-panel .modal-body { padding: 0; }
#embedIframe { width: 100%; height: 100%; border: none; display: block; }

/* 确认框 */
.confirm-panel { width: min(360px, 92%); }
.confirm-panel .modal-body { padding: 8px 22px 6px; text-align: center; }
.confirm-icon {
    width: 52px; height: 52px; margin: 6px auto 14px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 23px; background: rgba(255,159,10,0.14); color: var(--warning);
}
.confirm-icon.danger { background: rgba(255,77,79,0.13); color: var(--danger); }
.confirm-text { font-size: 14.5px; line-height: 1.55; color: var(--text-1); white-space: pre-line; }

/* Toast */
#toastWrap {
    position: fixed; top: 66px; left: 50%; transform: translateX(-50%);
    z-index: 2000; display: flex; flex-direction: column; gap: 9px; align-items: center;
    pointer-events: none;
}
.toast {
    display: flex; align-items: center; gap: 9px;
    padding: 11px 19px; border-radius: 999px;
    background: rgba(28, 31, 39, 0.88); backdrop-filter: blur(20px);
    color: #fff; font-size: 13.5px; font-weight: 500;
    box-shadow: var(--shadow-2); animation: toast-in 0.3s var(--ease);
}
.toast i { font-size: 15px; }
.toast.success i { color: #30d158; }
.toast.error i { color: #ff453a; }
.toast.out { animation: toast-out 0.3s forwards; }

/* 分类弹窗图标选择 */
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px; max-height: 180px; overflow-y: auto; }
.emoji-item {
    height: 40px; border-radius: 10px; font-size: 19px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; border: 1.5px solid transparent; transition: all 0.15s;
    background: rgba(255,255,255,0.5);
}
.emoji-item:hover { background: #fff; }
.emoji-item.active { border-color: var(--brand); background: #fff; }

/* ---------- 动画 ---------- */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.96) translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes panel-in { from { opacity: 0; transform: scale(0.94) translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(0.95); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px) scale(0.95); } }

/* ---------- 分类切换滑动动画（纵向翻页） ---------- */
.tags-anim { animation-duration: .3s; animation-timing-function: cubic-bezier(.4,0,.2,1); animation-fill-mode: both; }
@keyframes tagsOutUp    { to   { opacity:0; transform: translateY(-56px); } }
@keyframes tagsOutDown  { to   { opacity:0; transform: translateY(56px); } }
@keyframes tagsInBottom { from { opacity:0; transform: translateY(56px); }  to { opacity:1; transform:none; } }
@keyframes tagsInTop    { from { opacity:0; transform: translateY(-56px); } to { opacity:1; transform:none; } }
.tags-out-up    { animation-name: tagsOutUp; }
.tags-out-down  { animation-name: tagsOutDown; }
.tags-in-bottom { animation-name: tagsInBottom; }
.tags-in-top    { animation-name: tagsInTop; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
    .topbar { display: flex; }
    .workspace { inset: 52px 0 0 0; }
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 96; margin-left: -76px; }
    .sidebar.show { margin-left: 0; box-shadow: 14px 0 44px rgba(0,0,0,0.35); }
    .main-area { padding: 2px 18px 0; }
    .clock-time { font-size: 52px; }
    .tags-grid { row-gap: 12px; }
    /* 壁纸弹窗移动端：菜单横排在上 */
    .wp-body { flex-direction: column; overflow-y: auto; }
    .wp-side { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; padding: 0 0 8px; }
    .wp-side-item { flex-shrink: 0; padding: 8px 12px; }
    .wp-side-flex { display: none; }
    .wp-main { overflow: visible; }
    .wp-grid { grid-template-columns: repeat(2, 1fr); }
    /* 设置中心移动端：弹窗贴边铺满，图标条贴最左，内容宽度最大化 */
    #settingsModal { padding: 10px; }
    #settingsModal .modal-panel { width: 100%; height: min(780px, 94vh); }
    #settingsModal .modal-body { padding-left: 6px; padding-right: 6px; }
    .settings-wrap { flex-direction: row; overflow: hidden; gap: 6px; }
    .settings-nav {
        width: 34px; flex-shrink: 0; flex-direction: column;
        overflow-y: auto; border-right: none; padding: 0;
        border-bottom: none;
    }
    .sn-item { flex-shrink: 0; justify-content: center; gap: 0; padding: 10px 0; font-size: 0; }
    .sn-item i { font-size: 16px; }
    .sn-item .sn-txt { display: none; }
    .settings-nav .sn-user { padding: 2px 0 6px; justify-content: center; background: none; border: none; }
    .settings-nav .sn-avatar { width: 28px; height: 28px; font-size: 13px; border-radius: 9px; }
    .settings-nav .sn-uinfo, .settings-nav .sn-uarrow { display: none; }
    .settings-body { overflow-y: auto; padding-right: 0; }
    .set-row { padding: 11px 12px; }
    /* 设置项文字手机端缩小 */
    .set-row .sr-title { font-size: 9.5px; }
    .set-row .sr-desc { font-size: 9.5px; margin-top: 1px; }
    .we-wrap { flex-direction: column; overflow-y: auto; }
    .we-form { width: 100%; }
    .we-preview-area { min-height: 280px; }
    .widget-grid { grid-template-columns: repeat(2, 1fr); }
    .system-tags { grid-template-columns: 1fr; }
}

/* ---------- 访客只读模式（分享主页） ---------- */
.readonly-mode .sidebar-add,
.readonly-mode .side-btn,
.readonly-mode .dock-item.sys { display: none !important; }

.ro-badge {
    display: inline-flex; align-items: center; gap: 6px;
    margin-left: 10px; padding: 6px 14px;
    border-radius: 999px; font-size: 12px; font-weight: 600;
    color: #fff; background: rgba(255,255,255,0.16);
    border: 1px solid rgba(255,255,255,0.22);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    max-width: 60vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ro-badge i { font-size: 13px; flex-shrink: 0; }

/* ---------- 个人中心 ---------- */
.pf-head { text-align: center; padding: 16px 0 4px; }
.pf-avatar {
    position: relative; width: 76px; height: 76px; margin: 0 auto;
    border-radius: 50%; background: var(--brand-grad);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; overflow: hidden;
    box-shadow: 0 6px 18px rgba(79,107,255,0.35);
}
.pf-avatar .pf-letter { font-size: 30px; font-weight: 800; color: #fff; }
.pf-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pf-avatar .pf-mask {
    position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 0;
    font-size: 10.5px; color: #fff; background: rgba(0,0,0,0.5);
    opacity: 0; transition: opacity 0.2s;
}
.pf-avatar:hover .pf-mask { opacity: 1; }
.pf-name { font-size: 16px; font-weight: 800; margin-top: 10px; }
.pf-sub { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.pf-slug-row { display: flex; align-items: center; gap: 8px; }
.pf-slug-pre {
    flex-shrink: 0; font-size: 12.5px; color: var(--text-3);
    background: rgba(120,130,160,0.12); border-radius: 10px;
    padding: 0 12px; height: 42px; display: flex; align-items: center;
}
.pf-link { color: var(--brand); font-weight: 600; cursor: pointer; word-break: break-all; }
.pf-link:hover { text-decoration: underline; }
@media (max-width: 860px) {
    .pf-slug-pre { height: 36px; padding: 0 8px; font-size: 11px; }
    /* 手机端添加标签弹窗占满全宽 */
    #tagModal .modal-panel { width: min(1200px, 100%); }
}
