* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* =========================================================
   布局变量：整屏的垂直节奏都在这里调
   --optical-raise 是可选的「视觉居中补偿」（浏览器边框占据窗口
   顶部时把内容整体上抬）。经与原版截图比对，默认定位以原版
   标准为准：搜索框中心 = 视口 50%，时钟盒顶 = 50% - 120px，
   所以默认为 0；如需上抬，改这一个值即可。
   ========================================================= */
:root {
    /* 时钟底边 与 搜索框顶边 的间距：恒定值，任何屏幕都不变（桌面换算后 = 原版 top: calc(50% - 120px)） */
    --clock-gap: 53px;
    --search-h: 60px;                              /* 搜索栏总高 = padding*2 + 输入区高，须与断点里的实际内边距/输入高度一致 */
    --search-glass-bg: rgba(255, 255, 255, 0.6);  /* 搜索框与历史记录面板共用的玻璃底色，由「搜索栏 → 透明」联动 */
    --search-glass-blur: 15px;                     /* 毛玻璃强度：由「搜索栏 → 玻璃效果」开关切换，历史记录同步 */
    --search-glass-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    --clock-size: 70px;                            /* 时间主字号，可在「设置 → 时间/日期」里调节 */
    --clock-scale: 1;                              /* 窄屏等比缩放系数：缩放后字号仍随设置值变化，不会被写死 */
    --layout-shift: 0px;                           /* 首页内容整体上下位移：由「设置 → 布局 → 上下位置」按百分比换算 */
    --shortcut-gap: 12px;                          /* 图标之间的真实网格间距：由 JS 按「面板 / 桌面」各自的设置写入 */
    /* --shortcut-cell（隐藏底板边长）定义在 .shortcuts-container 上，按该元素实际继承到的
       --icon-wrap 现算：body.shortcuts-desktop 会覆盖 --icon-wrap，写在 :root 上取不到桌面值。
       底板只比「图标小方块 + 一行文字」大一圈，间距全部交给 --shortcut-gap，
       不再出现「底板留白 + grid 间距 = 间距加间距」的松散感。 */
    --icon-wrap: 72px;                            /* 紧贴图标的小方块尺寸，固定不随间距变化 */
    --optical-raise: 0px;
    --theme: #0a84ff;                              /* 主题色：由「设置 → 主题」覆盖；注册成 <color> 后可平滑过渡 */
    --bg-mask: transparent;                        /* 背景遮罩 */
    --bg-blur: 0px;                                /* 背景模糊 */
    --bg-scale: 1;
}

/* 关闭「玻璃效果」：去掉毛玻璃模糊与悬浮阴影，改用实色浅底；
   搜索框和历史记录下拉框共用这两个变量，天然同步。 */
body.no-search-glass {
    --search-glass-blur: 0px;
    --search-glass-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body, html {
    font-family: Arial, sans-serif;
}

/* 主体：弹性居中，时钟与搜索框永不重叠（任意屏幕比例） */
body {
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* 上下左右保持对称，内容盒中心才会等于视口中心
       （刘海安全区在页脚 / 一言 / 切换按钮上单独处理） */
    padding: 16px;
}

/* 背景层：fixed + 100%，避免 100vw 受滚动条影响、避免移动端地址栏伸缩导致跳动 */
#background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: #111;
    filter: blur(var(--bg-blur));
    transform: scale(var(--bg-scale));
    transform-origin: center center;
}

/* 主题设置：背景遮罩（盖在背景层上、内容层下） */
#bgMask {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: var(--bg-mask);
    pointer-events: none;
}

#background video,
#background img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

#background video.loaded,
#background img.loaded {
    opacity: 1;
}

#background video[poster] {
    opacity: 0;
}

#background video[poster].loaded {
    opacity: 1;
}

/* 搜索容器：整屏锚点，中心落在视口正中（--optical-raise 为 0 时）
   宽度随视口收缩而不是锁死：
   桌面取上限 600px；窄屏按 90vw 缩；矮屏（横屏手机等）再按 100vh 限制，
   避免又宽又扁的比例下搜索框显得过长。下限 200px 保证仍可正常输入。 */
.search-container {
    position: relative;
    z-index: 20;
    width: clamp(200px, min(90vw, 100vh), 600px);
    /* 视觉补偿 + 「上下位置」滑块的整体位移；时钟用同一个变量，两者永远一起走 */
    transform: translateY(calc(var(--layout-shift) - var(--optical-raise)));
}

/* 搜索栏样式 */
.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    padding: 10px 10px;
    background-color: var(--search-glass-bg);
    backdrop-filter: blur(var(--search-glass-blur));
    -webkit-backdrop-filter: blur(var(--search-glass-blur));
    border-radius: 50px;
    box-shadow: var(--search-glass-shadow);
    width: 100%;
    gap: 0;
}

/* 搜索引擎下拉菜单 */
.custom-select {
    position: relative;
    flex-shrink: 0;
    width: 46px;
}

.select-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 16px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s ease;
    line-height: 1;
}

.select-button svg {
    display: block;
    height: 1.25em;
    width: auto;
    vertical-align: middle;
}

/* 引擎下拉列表 */
.select-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 200px;
    max-width: 86vw;
    max-height: min(320px, 42vh);
    max-height: min(320px, 42dvh);
    overflow-y: auto;
    background-color: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(18px);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    display: none;
    z-index: 30;
}

.select-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.select-option:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

.select-option span {
    flex: 1;
    font-size: 14px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 自定义搜索引擎按钮 */
.select-option.add-engine-option {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(0, 0, 0, 0.6);
}

.select-option.add-engine-option:hover {
    background-color: rgba(255, 255, 255, 0.5);
    color: rgba(0, 0, 0, 0.8);
}

.select-option.add-engine-option svg {
    color: inherit;
}

/* 自定义搜索引擎图标 */
.select-option img {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    object-fit: contain;
    flex-shrink: 0;
}

/* 搜索引擎删除按钮 */
.select-option {
    position: relative;
}

.engine-delete-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(220, 50, 50, 0.85);
    border-radius: 50%;
    color: white;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, background-color 0.2s ease;
    z-index: 2;
}

.select-option:hover .engine-delete-btn {
    opacity: 1;
}

.engine-delete-btn:hover {
    background: rgba(220, 50, 50, 1);
}

/* 全站自定义细滚动条（不使用浏览器默认外观）
   Chrome 一旦设置 scrollbar-width / scrollbar-color 就会忽略 ::-webkit-scrollbar，
   因此标准属性只在 Firefox 生效，Chromium / Safari 走下面的 webkit 伪元素。 */
* { -ms-overflow-style: none; }                               /* IE / 旧 Edge */
*::-webkit-scrollbar { width: 6px; height: 6px; }            /* Chrome / Edge / Safari */
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: rgba(150, 150, 160, 0.42);
    background-clip: padding-box;
    border: 2px solid transparent;
    border-radius: 99px;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(110, 110, 122, 0.7); background-clip: padding-box; }
*::-webkit-scrollbar-corner { background: transparent; }

/* 浅色设置窗口内的滚动条用深灰细条，保证对比度 */
.settings-window *::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.28); background-clip: padding-box; }
.settings-window *::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.45); background-clip: padding-box; }

@supports (-moz-appearance: none) {
    * { scrollbar-width: thin; scrollbar-color: rgba(150, 150, 160, 0.45) transparent; }
    .settings-window * { scrollbar-color: rgba(0, 0, 0, 0.22) transparent; }
}

#searchInput {
    flex-grow: 1;
    padding: 0;
    font-size: 16px;
    line-height: 40px;
    height: 40px;
    border: none;
    outline: none;
    background: transparent;
    color: black;
    margin: 0;
    min-width: 0;
}

#searchButton {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: rgba(0, 0, 0, 0.65);
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

#searchButton:hover {
    background-color: rgba(255, 255, 255, 0.5);
    color: rgba(0, 0, 0, 0.85);
}

#searchButton svg {
    display: block;
}

/* 搜索建议 / 搜索历史：材质与搜索框完全同步（同一份玻璃底色、模糊、阴影），
   底色由 applySearchBarStyle 随「搜索栏 → 透明」滑块联动；
   只有圆角 / 高度这类尺寸不复用，下拉框保留自己的 10px 圆角。 */
.suggestions-list {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 20px);
    background-color: var(--search-glass-bg);
    backdrop-filter: blur(var(--search-glass-blur));
    -webkit-backdrop-filter: blur(var(--search-glass-blur));
    border-radius: 10px;
    box-shadow: var(--search-glass-shadow);
    z-index: 25;
    max-height: min(180px, 30vh);
    max-height: min(180px, 30dvh);
    overflow-y: auto;
    display: none;
}

/* 下拉项（联想词 + 搜索历史记录）统一深色文字，与浅色玻璃底保持高对比 */
.suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    color: #1d1d1f;
    font-size: 13.5px;
    text-shadow: none;
    transition: background-color 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-item:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

/* 时钟：脱离文档流，按「底边」锚定在搜索框上方固定距离处。
   这样无论字号、搜索框高度怎么随屏幕变化，两者的间距恒为 --clock-gap，
   不会出现一会儿远一会儿近。字号变化只会让时钟往上长，不会挤压间隔。
   字号 = 设置值 × --clock-scale：桌面系数为 1（直接用设置值），
   窄屏在断点里把系数调小以防撑破屏幕，但 36~120 整段滑块依然线性生效。
   旧写法 clamp(26px, var(--clock-size), 12vw) 的 12vw 是硬上限，
   手机上会把 50px 以上的设置值全部压成 12vw，导致「时间大小」怎么拖都不变。 */
#clock {
    position: absolute;
    left: 50%;
    bottom: calc(50% + var(--search-h) / 2 + var(--clock-gap) + var(--optical-raise));
    /* Y 位移与 .search-container 共用 --layout-shift，调整上下位置时时间不会和搜索框脱节 */
    transform: translate(-50%, var(--layout-shift));
    color: white;
    font-size: clamp(20px, calc(var(--clock-size, 90px) * var(--clock-scale, 1)), 20vw);
    font-weight: bold;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 5;
    white-space: nowrap;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
    /* 时间 / 日期是点击显隐捷径的热区，禁止选中文字：
       双击或手机上长按不会再出现蓝色选区 / 系统放大镜，也不会挡住点击 */
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}
/* 子元素显式继承，避免个别浏览器对 div 内容恢复可选 */
#clock .clock-time,
#clock .clock-date {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}
#clock ::selection { background: transparent; }
.clock-time { line-height: 1.06; }
.clock-date {
    display: block;
    margin-top: 0.22em;
    font-size: 0.28em;
    font-weight: 500;
    letter-spacing: 0.08em;
    opacity: 0.96;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), 0 0 9px rgba(0, 0, 0, 0.35);
}
/* 彩虹色：渐变裁切到文字，保留轻微投影以免在浅色壁纸上糊掉 */
.clock-rainbow .clock-time,
.clock-rainbow .clock-date {
    background-image: linear-gradient(95deg, #ff9ec0, #ffd77a, #9ce8b6, #86c9ff, #c9a9ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
}

/* 一言 */
#hitokoto {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 14px;
    text-align: center;
    font-style: italic;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 600px;
    z-index: 5;
    bottom: calc(45px + env(safe-area-inset-bottom));
    line-height: 1.6;
    padding: 0 12px;
    transition: bottom 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.footer-hidden #hitokoto {
    bottom: calc(20px + env(safe-area-inset-bottom)) !important;
    font-size: 15px;
}

/* 页脚 */
footer {
    position: fixed;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 0;
    width: 100%;
    text-align: center;
    color: white;
    font-size: 14px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    z-index: 5;
    padding: 0 12px;
    line-height: 1.6;
}

footer a.no-style {
    color: white;
    text-decoration: none;
    margin: 0 5px;
    white-space: nowrap;
}

footer a.no-style:hover {
    text-decoration: underline;
}

/* 公告弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(6px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.modal-content {
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 14px;
    width: min(92vw, 1000px);
    max-width: 1000px;
    max-height: 86vh;
    max-height: 86dvh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.modal-header h3 {
    color: white;
    font-size: 18px;
    font-weight: 600;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    text-align: center;
}

.modal-body {
    padding: 18px 22px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    color: rgba(255, 255, 255, 0.92);
    font-size: 14px;
    line-height: 1.7;
}

.modal-body h4 {
    margin: 16px 0 6px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.modal-body h4:first-child {
    margin-top: 0;
}

.modal-body ul {
    list-style: none;
    padding-left: 0;
    margin: 0 0 4px;
}

.modal-body li {
    padding: 3px 0 3px 14px;
    position: relative;
}

.modal-body li::before {
    content: "·";
    position: absolute;
    left: 0;
    color: rgba(255, 255, 255, 0.6);
    font-weight: bold;
}

.modal-body strong {
    color: white;
}

.modal-body a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-all;
}

.modal-body a:hover {
    color: white;
}

/* 公告中的功能图片 */
.feature-img {
    margin: 10px 0 16px;
    text-align: center;
}

.feature-img img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    object-fit: cover;
}

.feature-img img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.modal-footer button {
    margin: 0;
    padding: 9px 24px;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.25);
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.modal-footer button:hover {
    background: rgba(255, 255, 255, 0.45);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 右键菜单 */
.context-menu {
    display: none;
    position: fixed;
    width: min(92vw, 1000px);
    max-width: 1000px;
    /* min-height 不能超过可用高度，否则横屏手机会溢出视口 */
    min-height: min(520px, 86vh);
    min-height: min(520px, 86dvh);
    max-height: 90vh;
    max-height: 90dvh;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(15px);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 100;
    flex-direction: column;
}

.context-menu-header {
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.context-menu-header .window-title {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: inherit;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 捷径网格：底板紧凑，间距真实 */
.shortcuts-container {
    /* 隐藏底板 = 图标小方块 + 一行文字 + 少量内边距，不掺任何间距。
       变量写在容器本身，才能继承到 body.shortcuts-desktop 覆盖后的 --icon-wrap。 */
    --shortcut-cell: calc(var(--icon-wrap, 72px) + 38px);
    padding: 8px;
    display: grid;
    gap: var(--shortcut-gap, 12px);
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    /* 图标间距 = --shortcut-gap 这一个真实的 grid 间距；
       底板尺寸恒定，拉间距只会把图标互相推远，图标本身不会被一起放大。 */
    grid-template-columns: repeat(auto-fill, var(--shortcut-cell, 110px));
    grid-auto-rows: var(--shortcut-cell, 110px);
    justify-content: center;
    align-content: start;
    /* 容器空白区允许原生垂直滚动，手机上滑动才滚得动；
       卡片本身在 .shortcut-item 上设 touch-action:none，手势交给脚本判定滑动 / 长按拖拽 */
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}
/* 拖拽进行中：暂时锁死原生滚动，避免卡片跟着手指一起把页面带跑 */
.shortcuts-container.xn-dragging { touch-action: none; }

.shortcut-item {
    /* 热区紧贴内容：图标小方块 + 一行文字，多余的留白全部交给 --shortcut-gap */
    padding: 6px 4px;
    /* 大卡片底板纯透明：卡片本身只是一块点击 / 拖拽热区，
       真正的可见底板是紧贴图标的 .shortcut-icon-wrap 小方块。
       面板模式和桌面模式共用这套规则，只有外壳窗口不同。 */
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid transparent;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    position: relative;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    box-shadow: none;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease, background 0.25s ease;
    overflow: hidden;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    /* 卡片上的触摸手势完全由脚本接管：滑动=滚动面板，长按=拖拽排序 */
    touch-action: none;
}

/* 悬浮只提亮紧贴图标的小底板，大卡片区域始终纯透明 */
.shortcut-item:hover {
    transform: translateY(-2px);
}
.shortcut-item:hover .shortcut-icon-wrap {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.shortcut-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.shortcut-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 6px;
}

.shortcut-name {
    font-size: 12px;
    line-height: 1.35;
    /* 名称恒占一行，过长用真实的省略号收尾；不允许换行把底板撑高，
       也不允许溢出到相邻卡片上（卡片本身也有 overflow:hidden 兜底）。 */
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: 0 0 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    padding: 0 2px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.85), 0 0 3px rgba(0,0,0,0.5);
    font-weight: 700;
    box-sizing: border-box;
}

.shortcut-item .delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: rgba(220, 50, 50, 0.85);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: white;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.shortcut-item.edit-mode .delete-btn {
    display: flex !important;
}

/* 拖拽样式 */
.shortcut-item.placeholder {
    background: rgba(255,255,255,0.15) !important;
    border: 2px dashed rgba(255,255,255,0.4);
    border-radius: 14px;
    transition: none !important;
}

.shortcut-item.pressing {
    transform: scale(0.92);
    transition: transform 0.15s cubic-bezier(0.25, 1, 0.5, 1) !important;
}

.shortcut-item.dragging {
    opacity: 0.92;
    box-shadow: 0 12px 40px rgba(0,0,0,0.35);
    will-change: transform;
    cursor: grabbing;
    border-radius: 14px;
    transform-origin: center center;
}

/* 捷径菜单底部：按钮已迁到设置 / 右键菜单，这里只显示一条提示文字 */
.context-menu-footer {
    padding: 10px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-shrink: 0;
    margin-top: auto;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    font-size: 12px;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
}
.panel-brand {
    color: #fff;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
    flex-shrink: 0;
}
.panel-tip {
    color: rgba(255, 255, 255, 0.88);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}
.panel-tip:hover { color: #fff; text-decoration: underline; }

/* 右上角设置按钮样式见文件末尾 .corner-btn */

/* 自定义背景层：封面图在下、视频在上。
   视频缓冲期间封面图一直可见，视频有首帧后才淡入覆盖，不会闪黑 / 消失。 */
#customVideoBg, #customImageBg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    z-index: -1;
}
#customImageBg { z-index: 0; }
#customVideoBg { z-index: 1; }

/* 新建捷径弹窗 */
#shortcutModal {
    z-index: 200;
}

.shortcut-modal-content {
    max-width: 420px;
    width: min(92vw, 420px);
    min-height: auto;
}

.shortcut-modal-content .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.shortcut-modal-body {
    padding: 20px 22px !important;
}

.shortcut-form-group {
    margin-bottom: 18px;
}

.shortcut-form-group:last-child {
    margin-bottom: 0;
}

.shortcut-form-group label {
    display: block;
    font-size: 13px;
    color: rgba(255,255,255,0.85);
    margin-bottom: 8px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.shortcut-form-group label .optional {
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    font-weight: 400;
}

.shortcut-form-group input {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    outline: none;
    transition: all 0.25s ease;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.shortcut-form-group input::placeholder {
    color: rgba(255,255,255,0.4);
}

.shortcut-form-group input:focus {
    border-color: rgba(255,255,255,0.45);
    background: rgba(255,255,255,0.18);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.1), inset 0 1px 2px rgba(0,0,0,0.1);
}

.shortcut-hint {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    margin-top: 6px;
    margin-bottom: 0;
}

/* =========================================================
   响应式布局
   ========================================================= */

/* 超大屏（2K / 4K / 带鱼屏）：中心内容适度放大，避免显得过小 */
@media (min-width: 1800px) {
    /* 不再单独放大时钟字号（原 38px 偏大），统一由「设置 → 时间/日期」的字号控制 */
    .search-container {
        max-width: 680px;
    }
}

/* 中等屏幕（笔记本 / 小桌面） */
@media (max-width: 1100px) {
    .context-menu {
        width: min(95vw, 1000px);
    }
}

/* 平板 / 小窗口 */
@media (max-width: 820px) {
    :root {
        --search-h: 56px;   /* padding 8*2 + 40 */
    }
    .search-bar {
        padding: 8px 8px;
    }
    #hitokoto {
        font-size: 13px;
    }
    footer {
        font-size: 13px;
    }
}

/* 移动端适配 */
@media (max-width: 600px) {
    :root {
        /* 窄屏：时间字号按 0.6 等比缩小，但滑块仍能线性调节；
           时钟与搜索框的间距也从桌面的 53px 收紧到 36px，避免小屏上显得空 */
        --clock-scale: 0.6;
        --clock-gap: 36px;
    }
    .shortcuts-container { padding: 6px; }
    .shortcut-item {
        padding: 5px 3px;
        border-radius: 10px;
    }
    .shortcut-icon-wrap {
        width: 30px;
        height: 30px;
        border-radius: 8px;
    }
    .shortcut-icon {
        width: 22px;
        height: 22px;
    }
    .shortcut-name {
        font-size: 11px;
    }
    .modal-header {
        padding: 14px 16px;
    }
    .modal-body {
        padding: 14px 16px;
        font-size: 13px;
    }
    .modal-footer {
        padding: 12px 16px;
        gap: 10px;
    }
    .modal-footer button {
        padding: 9px 18px;
        font-size: 13px;
    }
    .feature-img img {
        max-height: 150px;
    }
    footer {
        font-size: 12px;
    }
}

/* 窄屏手机 */
@media (max-width: 420px) {
    .select-menu {
        width: min(200px, 88vw);
    }
    .context-menu-footer {
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
        font-size: 11px;
    }
    footer a.no-style {
        margin: 0 3px;
    }
}

/* 超窄屏（<360px，如折叠屏外屏 / 极小窗口） */
@media (max-width: 360px) {
    :root {
        --search-h: 52px;   /* padding 6*2 + 40 */
        --clock-scale: 0.56;
    }
    .search-bar {
        padding: 6px;
    }
}

/* ---------- 纵向：矮屏（横屏手机、小窗口、低比例显示器） ---------- */
@media (max-height: 620px) {
    :root {
        /* 矮屏 / 横屏：只把搜索框做矮、间距再收紧，字号仍由设置值 × 系数决定 */
        --search-h: 50px;   /* padding 7*2 + 36 */
        --clock-gap: 28px;
    }
    .search-bar {
        padding: 7px 8px;
    }
    #searchInput {
        height: 36px;
        line-height: 36px;
        font-size: 16px;
    }
    .select-button,
    #searchButton {
        width: 36px;
        height: 36px;
    }
    .feature-img img {
        max-height: 130px;
    }
    #hitokoto {
        bottom: calc(32px + env(safe-area-inset-bottom));
        font-size: 13px;
    }
    footer {
        bottom: calc(8px + env(safe-area-inset-bottom));
        font-size: 12px;
    }
}

@media (max-height: 460px) {
    :root {
        --search-h: 46px;   /* padding 6*2 + 34 */
        --clock-gap: 22px;
    }
    .search-bar {
        padding: 6px;
    }
    #searchInput {
        height: 34px;
        line-height: 34px;
    }
    .select-button,
    #searchButton {
        width: 34px;
        height: 34px;
    }
    .shortcuts-container { padding: 6px; }
    .shortcut-item {
        padding: 4px 2px;
    }
    .shortcut-icon-wrap {
        width: 26px;
        height: 26px;
        border-radius: 7px;
    }
    .shortcut-icon {
        width: 20px;
        height: 20px;
    }
    .shortcut-name {
        font-size: 10px;
    }
    .context-menu-header {
        padding: 6px 12px;
    }
    .context-menu-footer {
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
        font-size: 10.5px;
    }
    footer {
        font-size: 11px;
    }
    .modal-header {
        padding: 12px 16px;
    }
    .modal-footer {
        padding: 10px 16px;
    }
}

/* 矮屏 / 横屏手机：高度不够时时间字号再缩一档，避免大字号把时钟顶出屏幕。
   加 min-width 限定，避免覆盖窄屏（≤600px）已有的 0.6 / 0.56 系数。 */
@media (max-height: 520px) and (min-width: 601px) {
    :root {
        --clock-scale: 0.62;
    }
}

/* 横屏手机：菜单尽量铺满可用高度，按钮区不被挤压 */
@media (orientation: landscape) and (max-height: 520px) {
    .context-menu {
        width: min(96vw, 1000px);
        min-height: min(520px, 92vh);
        min-height: min(520px, 92dvh);
        max-height: 94vh;
        max-height: 94dvh;
    }
}

/* ---------- 输入方式：触屏设备没有 hover ----------
   引擎删除按钮依赖 :hover，触屏下常显才能删除。
   设置按钮不在此列：默认「自动隐藏」在电脑与手机上表现一致，
   是否常显交给「设置 → 布局」的开关（body.corner-always-visible）。 */
@media (hover: none) {
    .engine-delete-btn {
        opacity: 1;
    }
}

/* 尊重系统「减弱动态效果」设置 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- 小念：正方形捷径卡片 / 卡片右键菜单 / 删除确认 ---------- */
/* 行高与列宽统一由 --shortcut-cell 决定，卡片 height:100% 严格跟随行高，
   不再用 aspect-ratio 自行撑高（否则 grid 行按内容算高，卡片会互相压叠）。
   --card-size 仍由 syncSquareCards 写入，仅在变量缺失时作兜底。 */
.context-menu .shortcuts-container {
    grid-auto-rows: var(--shortcut-cell, var(--card-size, 110px));
}
.context-menu .shortcut-item {
    height: 100%;
    aspect-ratio: auto;
}

/* 图标块固定尺寸：间距滑块只放大隐形底板，图标和它的小底板保持不变。
   选择器只用卡片自身作锚点，不能带 .context-menu 祖先前缀：
   拖拽时卡片会被临时 appendChild 到 body，带前缀的规则会全部失效、
   图标瞬间回退（长按时看到的「二次缩小」）。 */
.shortcut-item > .shortcut-icon-wrap {
    width: var(--icon-wrap, 72px);
    height: var(--icon-wrap, 72px);
    border-radius: 16px;
}
.shortcut-icon-wrap > .shortcut-icon {
    width: 80%;
    height: 80%;
    border-radius: 10px;
}

/* 长按反馈只作用于图标小底板，大卡片区域不出现边框 / 阴影 */
.shortcut-item.pressing {
    transform: none;
    border-color: transparent;
    box-shadow: none;
    transition: none !important;
}
.shortcut-item.pressing .shortcut-icon-wrap {
    background: rgba(255, 255, 255, 0.34);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.45), 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 卡片右键菜单：浅色毛玻璃 + 深色文字，保证可读 */
.item-context-menu {
    display: none;
    position: fixed;
    z-index: 150;
    min-width: 140px;
    padding: 6px;
    flex-direction: column;
    gap: 2px;
    background-color: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}
.item-menu-btn {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #2b3444;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    text-shadow: none;
    transition: background 0.2s ease, transform 0.2s ease;
}
.item-menu-btn:hover {
    background: rgba(0, 0, 0, 0.07);
    transform: translateY(-1px);
}
/* 危险项：只有文字是红色，底色与其余菜单项一致 */
.item-menu-btn.danger {
    color: #d92d20;
    font-weight: 600;
    background: transparent;
    border-color: transparent;
}
.item-menu-btn.danger:hover {
    background: rgba(217, 45, 32, 0.10);
}

/* 删除确认弹窗：沿用新建捷径弹窗的尺寸与骨架 */
#confirmDeleteModal { z-index: 200; }
.confirm-modal-content {
    width: min(92vw, 420px);
    max-width: 420px;
    background-color: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.32);
}
.confirm-modal-content .modal-header h3 {
    flex: 1;
    text-align: center;
    padding-left: 36px;   /* 抵消右上角关闭按钮宽度，标题视觉居中 */
}
.confirm-modal-body {
    text-align: center;
    padding: 22px 24px !important;
}
.confirm-modal-body p { margin: 0 0 8px; }
.confirm-modal-body #confirmDeleteText {
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.confirm-modal-body .confirm-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
/* 确认按钮与普通按钮同款胶囊底，仅文字/描边为红色 */
.modal-footer button.btn-danger-text {
    color: #ff6b66;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 120, 115, 0.55);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.modal-footer button.btn-danger-text:hover {
    color: #ff4d47;
    background: rgba(217, 45, 32, 0.20);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

/* ---------- 小念：右上角设置按钮 + macOS 风格设置面板 ---------- */
.corner-actions {
    position: fixed;
    top: calc(10px + env(safe-area-inset-top));
    right: calc(10px + env(safe-area-inset-right));
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
}
/* 设置窗口：浅色玻璃 + 红黄绿交通灯 + 左侧分类栏 */
#settingsModal { z-index: 300; }
.settings-window {
    width: min(92vw, 840px);
    height: min(86vh, 580px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.75);
    background: rgba(246, 247, 250, 0.88);
    backdrop-filter: blur(30px) saturate(150%);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.06);
    color: #1d1d1f;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.settings-titlebar {
    height: 42px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    background: rgba(255, 255, 255, 0.28);
    position: relative;
}
.traffic-lights { display: flex; gap: 8px; }
.tl { width: 12px; height: 12px; border-radius: 50%; border: 0; padding: 0; display: block; }
.tl-close { background: #ff5f57; cursor: pointer; }
.tl-close:hover { background: #e0443e; }
.tl-min { background: #febc2e; }
.tl-max { background: #28c840; }
.settings-title {
    position: absolute;
    left: 0; right: 0;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #4a4a4f;
    pointer-events: none;
}
.settings-body { display: flex; flex: 1 1 auto; min-height: 0; }
.settings-sidebar {
    width: 208px;
    flex-shrink: 0;
    padding: 14px 10px;
    background: rgba(255, 255, 255, 0.32);
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    overflow-y: auto;
}
.settings-search {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    margin-bottom: 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.05);
    color: #8a8a8e;
    font-size: 12px;
}
.settings-nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 3px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #2b2b2e;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
}
.settings-nav-item:hover { background: rgba(0, 0, 0, 0.06); }
.settings-nav-item.active { background: var(--theme); color: #fff; font-weight: 600; }
.nav-icon {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.nav-icon.general { background: linear-gradient(135deg, #7b8cff, #5b6ef5); }
.nav-icon.wallpaper { background: linear-gradient(135deg, #4fc3f7, #1e88e5); }
.nav-icon.about { background: linear-gradient(135deg, #9aa3ad, #6c757d); }
.nav-icon.search { background: linear-gradient(135deg, #b39bff, #7c5cff); }
.nav-icon.theme { background: linear-gradient(135deg, #ff9ec0, #ef5f96); }
.nav-icon.layout { background: linear-gradient(135deg, #6fd6b0, #20a97b); }
.nav-icon.data { background: linear-gradient(135deg, #8fb8ff, #4f7de0); }
/* 「数据」页行内按钮与危险项 */
.settings-row > .settings-small-btn { flex: 0 0 auto; margin-left: 12px; font-weight: 600; }
.settings-small-btn.data-danger { color: #d92d20; border-color: rgba(217, 45, 32, 0.28); }
.settings-small-btn.data-danger:hover { background: #fff5f4; }

/* ===== 通用滑块行：搜索栏 / 主题 / 时间大小共用同一套 macOS 细滑块 ===== */
.settings-slider-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 16px;
}
.settings-slider-row + .settings-slider-row { border-top: 1px solid rgba(0, 0, 0, 0.06); }
.slider-list { border-top: 1px solid rgba(0, 0, 0, 0.06); }
.slider-label { flex: 0 0 84px; font-size: 13px; font-weight: 600; color: #2b2b2e; }
.slider-value { flex: 0 0 52px; text-align: right; font-size: 12.5px; color: #6e6e73; font-variant-numeric: tabular-nums; }
.settings-slider-row input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    flex: 1 1 auto;
    min-width: 60px;
    height: 4px;
    border-radius: 4px;
    background: linear-gradient(to right,
        var(--theme) 0%, var(--theme) var(--range, 40%),
        #d1d1d6 var(--range, 40%), #d1d1d6 100%);
    outline: none;
    cursor: pointer;
}
.settings-slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
    cursor: pointer;
}
.settings-slider-row input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: #d1d1d6; }
.settings-slider-row input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--theme); }
.settings-slider-row input[type="range"]::-moz-range-thumb {
    width: 15px; height: 15px; border-radius: 50%;
    background: #fff; border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28); cursor: pointer;
}

/* ===== 颜色色块（时间颜色 / 主题色） ===== */
.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 6px 16px 18px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.color-swatch {
    width: 26px; height: 26px;
    flex-shrink: 0;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.14);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.color-swatch:hover { transform: scale(1.12); }
.color-swatch.active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--theme); }
.color-swatch.is-white { background: #fff; }

/* ===== 主题：壁纸预览卡片 ===== */
.theme-wallpaper-group .settings-row { padding-bottom: 8px; }
.theme-wallpaper-preview {
    position: relative;
    margin: 0 16px 16px;
    height: 150px;
    border-radius: 10px;
    overflow: hidden;
}
.theme-wallpaper-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.theme-wallpaper-actions {
    position: absolute;
    left: 0; right: 0; bottom: 12px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 7px;
    padding: 0 10px;
}
.theme-wallpaper-actions .settings-small-btn {
    border: 0;
    padding: 7px 12px;
    font-size: 11.5px;
    white-space: nowrap;
    color: var(--theme);
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

/* 捷径菜单关闭按钮：与设置窗口交通灯同款，其余菜单样式不变 */
#closeContextMenu.ctx-close { flex-shrink: 0; }
.settings-content { flex: 1 1 auto; min-width: 0; overflow-y: auto; padding: 24px 30px 20px; }
.settings-panel { display: none; }
.settings-panel.active { display: block; }
.settings-panel h2 { margin: 0 0 4px; font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
.settings-desc { margin: 0 0 14px; font-size: 12.5px; color: #6e6e73; }
.settings-group {
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
}
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 16px;
}
.settings-row + .settings-row { border-top: 1px solid rgba(0, 0, 0, 0.06); }
.row-text strong { display: block; font-size: 13.5px; font-weight: 600; }
.row-text small { display: block; margin-top: 3px; font-size: 11.5px; color: #8a8a8e; }
.settings-note { font-size: 11.5px; color: #8a8a8e; line-height: 1.6; }

/* 时间/日期设置：与 macOS 设置面板同款的浅色分组卡片 */
.nav-icon.clock { background: linear-gradient(135deg, #ffc46b, #f08c24); }
.clock-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 4px 16px 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.clock-opt {
    padding: 11px 4px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.055);
    color: #2b2b2e;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.clock-opt:hover { background: rgba(0, 0, 0, 0.09); transform: translateY(-1px); }
.clock-opt.active { background: color-mix(in srgb, var(--theme) 12%, transparent); border-color: var(--theme); color: var(--theme); }
.clock-size-control { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.clock-size-control input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 170px;
    height: 4px;
    border-radius: 4px;
    background: linear-gradient(to right,
        var(--theme) 0%, var(--theme) var(--clock-range, 40%),
        #d1d1d6 var(--clock-range, 40%), #d1d1d6 100%);
    outline: none;
    cursor: pointer;
}
.clock-size-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
    cursor: pointer;
}
.clock-size-control input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: #d1d1d6; }
.clock-size-control input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--theme); }
.clock-size-control input[type="range"]::-moz-range-thumb {
    width: 15px; height: 15px; border-radius: 50%;
    background: #fff; border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28); cursor: pointer;
}
.clock-size-control > span {
    min-width: 48px;
    text-align: right;
    font-size: 12.5px;
    color: #6e6e73;
    font-variant-numeric: tabular-nums;
}

/* macOS 开关 */
.mac-switch { position: relative; display: inline-block; flex-shrink: 0; cursor: pointer; }
.mac-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.mac-switch-track {
    display: block;
    width: 42px;
    height: 25px;
    border-radius: 20px;
    background: #d1d1d6;
    transition: background 0.2s ease;
}
.mac-switch-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.mac-switch input:checked + .mac-switch-track { background: var(--theme); }
.mac-switch input:checked + .mac-switch-track::after { transform: translateX(17px); }
.mac-switch input:focus-visible + .mac-switch-track { outline: 3px solid color-mix(in srgb, var(--theme) 35%, transparent); outline-offset: 2px; }

/* 壁纸网格 */
.wallpaper-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.settings-small-btn {
    padding: 6px 14px;
    border-radius: 7px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.85);
    color: #2b2b2e;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: background 0.15s ease, transform 0.15s ease;
}
.settings-small-btn:hover { background: #fff; transform: translateY(-1px); }
.wallpaper-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(122px, 1fr));
    gap: 10px;
    min-height: 68px;
    max-height: min(240px, 34vh);
    overflow-y: auto;
    padding: 2px;
}
.wallpaper-tile {
    position: relative;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 9px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 16 / 9;
    background: #e5e5ea;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.18s ease, border-color 0.18s ease;
}
.wallpaper-tile:hover { transform: translateY(-2px); }
.wallpaper-tile.selected { border-color: var(--theme); }
.wallpaper-tile.selected::after {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 5px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: var(--theme);
    color: #fff;
    font-size: 11px;
    line-height: 17px;
    text-align: center;
}
.wallpaper-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wallpaper-tile.failed { background: linear-gradient(135deg, #e3e7ee, #c9d1e0); }
.tile-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #5d626d;
    letter-spacing: 0.04em;
    pointer-events: none;
}
.wallpaper-status { font-size: 11.5px; color: #6e6e73; }
.wallpaper-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.about-card { display: flex; align-items: center; gap: 14px; padding: 18px; }
.about-logo {
    width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #8b7cff, #5b6ef5);
    color: #fff; font-size: 24px; font-weight: 700;
}
.about-card strong { font-size: 14px; }
.about-card p { margin: 4px 0 0; font-size: 12px; color: #8a8a8e; }

@media (max-width: 680px) {
    .settings-window { height: min(90vh, 620px); }
    .settings-body { flex-direction: column; }
    .settings-sidebar {
        width: 100%;
        display: flex;
        gap: 6px;
        padding: 8px;
        border-right: 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        overflow-x: auto;
    }
    .settings-search { display: none; }
    .settings-nav-item { width: auto; white-space: nowrap; margin: 0; padding: 6px 10px; }
    .settings-content { padding: 18px; }
    .clock-size-control input[type="range"] { width: 120px; }
    .clock-options { gap: 8px; padding: 4px 12px 12px; }
    .corner-settings-btn span { display: none; }
    .corner-settings-btn { padding: 9px 11px; }
}


/* ============================================================
   小念：统一按钮 / 自定义滚动条 / tooltip / 对话框 / 分类 / 历史
   ============================================================ */

/* 右上角按钮：默认隐藏；悬停容器（或按钮获得焦点）时淡入 */
.corner-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 15px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease, background 0.2s ease, transform 0.2s ease;
}
.corner-actions:hover .corner-btn,
.corner-actions:focus-within .corner-btn { opacity: 1; }
/* 「设置 → 布局 → 设置按钮常显」：打开后无视 hover，电脑和手机都一直显示。
   选择器带 body 限定，优先级高于上面的 hover 规则。 */
body.corner-always-visible .corner-btn,
body.corner-always-visible .corner-actions .corner-btn { opacity: 1; }
.corner-btn:hover {
    background: rgba(255, 255, 255, 0.52);
    transform: translateY(-1px);
}
.corner-btn:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.9); outline-offset: 2px; }
@media (max-width: 680px) {
    .corner-btn { padding: 9px 12px; }
    .corner-btn span { display: none; }
}

/* 自定义 tooltip：挂在元素自身的 ::after 会被 .settings-content 的滚动容器
   与 .settings-window 的 overflow:hidden 裁切，统一改由 body 上的固定浮层接管 */
[data-tooltip] { position: relative; }
[data-tooltip]::after { content: none !important; display: none !important; }
.xn-float-tip {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 9999;
    max-width: 260px;
    padding: 6px 11px;
    border-radius: 8px;
    background: rgba(28, 28, 32, 0.94);
    color: #fff;
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.35;
    white-space: nowrap;
    text-shadow: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.32);
    border: 1px solid rgba(255, 255, 255, 0.12);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.16s ease, transform 0.16s ease;
}
.xn-float-tip.show { opacity: 1; visibility: visible; transform: translateY(0); }

/* 通用对话框：macOS 浅色风格，替代原生 confirm / alert */
#confirmDeleteModal.xn-dialog-modal { z-index: 400; }
#confirmDeleteModal .xn-dialog {
    background: rgba(246, 247, 250, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(0, 0, 0, 0.05);
    color: #1d1d1f;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
}
#confirmDeleteModal .xn-dialog .modal-header {
    position: relative;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    padding: 14px 44px;
}
#confirmDeleteModal .xn-dialog .modal-header h3 {
    color: #1d1d1f;
    font-size: 15px;
    text-shadow: none;
}
#confirmDeleteModal .xn-dialog .close-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #6e6e73;
    font-size: 20px;
}
#confirmDeleteModal .xn-dialog .close-btn:hover { color: #1d1d1f; }
#confirmDeleteModal .xn-dialog .modal-body { color: #3a3a3c; }
#confirmDeleteModal .xn-dialog #confirmDeleteText {
    color: #1d1d1f;
    font-size: 14px;
    font-weight: 600;
    text-shadow: none;
    white-space: pre-line;
}
#confirmDeleteModal .xn-dialog .confirm-hint {
    color: #8a8a8e;
    text-shadow: none;
}
#confirmDeleteModal .xn-dialog .modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.07);
    justify-content: flex-end;
    padding: 12px 18px;
}
#confirmDeleteModal .xn-dialog .modal-footer button {
    margin: 0;
    padding: 7px 18px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #2b2b2e;
    font-size: 13px;
    font-weight: 500;
    text-shadow: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
#confirmDeleteModal .xn-dialog .modal-footer button:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
#confirmDeleteModal .xn-dialog .modal-footer button.btn-danger-text {
    color: #d92d20;
    font-weight: 600;
    border-color: rgba(217, 45, 32, 0.38);
    background: rgba(255, 255, 255, 0.9);
}
#confirmDeleteModal .xn-dialog .modal-footer button.btn-danger-text:hover {
    background: rgba(217, 45, 32, 0.10);
}

/* 自定义轻提示 toast */
.xn-toast-wrap {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}
.xn-toast {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    background: rgba(246, 247, 250, 0.94);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
    color: #1d1d1f;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    animation: xnToastIn 0.26s ease both;
}
.xn-toast .toast-dot { width: 8px; height: 8px; border-radius: 50%; background: #34c759; flex-shrink: 0; }
.xn-toast.error .toast-dot { background: #ff5f57; }
.xn-toast.out { animation: xnToastOut 0.24s ease both; }
@keyframes xnToastIn { from { opacity: 0; transform: translateY(-10px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes xnToastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-8px); } }

/* 壁纸分类切换按钮 */
.wallpaper-cats-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 8px;
}
.wallpaper-cats {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 2px 2px 8px;
}
.wallpaper-cat-nav {
    flex: 0 0 auto;
    width: 26px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    color: #3a3a3c;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: background 0.15s ease, transform 0.15s ease;
}
.wallpaper-cat-nav:hover { background: #fff; transform: translateY(-1px); }
.wallpaper-cats::-webkit-scrollbar { height: 4px; }
.wallpaper-cats::-webkit-scrollbar-thumb { border-width: 1px; }
.wallpaper-cat {
    flex: 0 0 auto;
    padding: 6px 13px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.72);
    color: #3a3a3c;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.wallpaper-cat:hover { background: #fff; transform: translateY(-1px); }
.wallpaper-cat.active {
    background: var(--theme);
    border-color: var(--theme);
    color: #fff;
    font-weight: 600;
}
.wallpaper-cat.video-cat::before { content: '▶ '; font-size: 10px; }
.wallpaper-pager { display: flex; align-items: center; gap: 6px; }
.wallpaper-pager .settings-small-btn { min-width: 32px; padding: 6px 10px; }
.wallpaper-tile .tile-badge {
    position: absolute;
    left: 5px;
    bottom: 5px;
    padding: 2px 7px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 10px;
    line-height: 1.4;
    pointer-events: none;
}

/* 网页自定义搜索历史（替代浏览器原生历史下拉）
   浮层本身保持浅色玻璃，「搜索历史 / 清空 / 每条记录文字」统一用深色文字 */
.suggestion-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px 7px;
    color: #1d1d1f;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.4px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.16);
}
.history-clear {
    border: 1px solid rgba(0, 0, 0, 0.22);
    background: rgba(255, 255, 255, 0.5);
    color: #1d1d1f;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    padding: 3px 10px;
    border-radius: 6px;
    transition: background 0.18s ease, transform 0.18s ease;
}
.history-clear:hover {
    background: rgba(255, 255, 255, 0.85);
    color: #1d1d1f;
    transform: translateY(-1px);
}
.history-item { display: flex; align-items: center; gap: 10px; }
.history-clock { opacity: 0.85; font-size: 14px; width: 14px; flex-shrink: 0; text-align: center; color: #1d1d1f; }
.history-text {
    flex: 1 1 auto;
    min-width: 0;
    color: #1d1d1f;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* 右侧感应区：只有鼠标悬停到「这一条的右侧」才显示这一条的叉号 */
.history-actions {
    flex: 0 0 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    margin: -10px -15px -10px 0;
    padding: 0 8px;
}
.history-del {
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 6px;              /* 圆角方形底板 */
    display: flex;
    align-items: center;
    justify-content: center;
    /* 浅色底板：只比记录条略深一点，深色叉号用 SVG 绘制 */
    background: rgba(0, 0, 0, 0.085);
    color: #1d1d1f;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease;
}
.history-del svg { display: block; width: 12px; height: 12px; }
.history-actions:hover .history-del {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
/* 鼠标悬浮在叉号按钮上时底板保持同色，不做变色反馈 */
.history-del:hover { background: rgba(0, 0, 0, 0.085); }

/* =========================================================
   统一 macOS 窗口：交通灯居左 + 标题居中 + 浅色玻璃
   ========================================================= */
.xn-titlebar {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-shrink: 0;
    padding: 12px 16px !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}
.context-menu-header.xn-titlebar { border-bottom-color: rgba(255, 255, 255, 0.2) !important; }
.xn-titlebar .traffic-lights { position: relative; z-index: 1; flex-shrink: 0; }
.xn-titlebar .window-title,
.xn-titlebar h3 {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    margin: 0 !important;
    text-align: center !important;
    pointer-events: none;
    white-space: nowrap;
}
.xn-titlebar h3 {
    color: #1d1d1f !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-shadow: none !important;
}
/* 捷径面板本身是深色玻璃，标题保持白字 */
.context-menu-header.xn-titlebar .window-title {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

/* 编辑/新建捷径、添加自定义搜索引擎：与设置面板同款浅色 macOS 窗口 */
.xn-window {
    background: rgba(246, 247, 250, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.88) !important;
    border-radius: 14px !important;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(0, 0, 0, 0.05) !important;
    color: #1d1d1f !important;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
    overflow: hidden;
}
.xn-window .modal-body { color: #3a3a3c !important; text-shadow: none !important; }
.xn-window .shortcut-form-group label { color: #3a3a3c !important; text-shadow: none !important; }
.xn-window .shortcut-form-group label .optional { color: #8a8a8e !important; }
.xn-window .shortcut-form-group input {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(0, 0, 0, 0.14) !important;
    border-radius: 8px !important;
    color: #1d1d1f !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
.xn-window .shortcut-form-group input::placeholder { color: #9a9a9f !important; }
.xn-window .shortcut-form-group input:focus {
    border-color: var(--theme) !important;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.07) !important;
}
.xn-window .shortcut-hint { color: #8a8a8e !important; }
.xn-window .modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.07) !important;
    justify-content: flex-end !important;
    padding: 12px 18px !important;
}
.xn-window .modal-footer button {
    padding: 7px 18px !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.92) !important;
    color: #2b2b2e !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    text-shadow: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}
.xn-window .modal-footer button:hover {
    background: #fff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
}
.xn-window .modal-footer button#btnConfirmShortcut,
.xn-window .modal-footer button#btnConfirmSearchEngine {
    background: var(--theme) !important;
    border-color: var(--theme) !important;
    color: #fff !important;
    font-weight: 600;
}

/* 场景右键菜单 / 时间可点击 */
.scene-menu { min-width: 156px; z-index: 220; }
#clock { cursor: pointer; }

/* =========================================================
   使用指南：和捷径面板同款半透明玻璃 + macOS 窗口
   窗口框沿用 .context-menu 的 0.3 白 + blur(15px) + 12px 圆角，
   内容用浅色卡片承托深色文字，保证任意壁纸上都看得清。
   ========================================================= */
#noticeModal {
    /* 只做很轻的压暗，别把玻璃盖成灰色：透出壁纸才和捷径面板一个质感 */
    background-color: rgba(0, 0, 0, 0.14);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
#noticeModal .xn-guide-window {
    width: min(92vw, 860px) !important;
    max-width: 860px !important;
    max-height: 86vh;
    max-height: 86dvh;
    background-color: rgba(255, 255, 255, 0.3) !important;
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    border: 1px solid rgba(255, 255, 255, 0.42) !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
}
#noticeModal .xn-guide-window .xn-titlebar {
    background: rgba(255, 255, 255, 0.16);
    border-bottom: 1px solid rgba(255, 255, 255, 0.38) !important;
}
#noticeModal .xn-guide-window .xn-titlebar h3 { color: #1d1d1f !important; }

.guide-body {
    padding: 16px 20px !important;
    color: #3a3a3c !important;
    text-shadow: none !important;
    font-size: 13.5px;
    line-height: 1.75;
}
.guide-body p { margin: 0; color: #3a3a3c; }
.guide-body strong, .guide-body b { color: #1d1d1f; font-weight: 700; }
.guide-hello {
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    padding: 11px 14px;
    margin-bottom: 12px !important;
}
.guide-step {
    display: grid;
    grid-template-columns: 26px 1fr;
    gap: 2px 12px;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
}
.guide-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--theme);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}
.guide-copy h4 {
    margin: 0 0 4px !important;
    color: #1d1d1f !important;
    font-size: 14.5px !important;
    font-weight: 700 !important;
    text-shadow: none !important;
}
.guide-figure { grid-column: 1 / -1; margin: 10px 0 0; }
.guide-figure img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    object-position: center center;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.guide-figure img:hover { transform: scale(1.008); box-shadow: 0 5px 18px rgba(0, 0, 0, 0.22); }
.guide-figure figcaption { margin-top: 6px; font-size: 11.5px; color: #6e6e73; text-align: center; }
.guide-tips {
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    padding: 11px 14px;
    margin-top: 14px;
}
.guide-tips h4 {
    margin: 0 0 4px !important;
    color: #1d1d1f !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    text-shadow: none !important;
}
.guide-tips p { font-size: 12.8px; }
.guide-links { margin-top: 12px !important; font-size: 12px; color: #5a5a5f; text-align: center; }
#noticeModal .guide-body a { color: var(--theme); text-decoration: none; font-weight: 600; }
#noticeModal .guide-body a:hover { text-decoration: underline; }
#noticeModal .modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.38) !important;
    background: rgba(255, 255, 255, 0.12);
    justify-content: flex-end !important;
    padding: 12px 16px !important;
}
#noticeModal .modal-footer button {
    margin: 0;
    padding: 7px 18px !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.88) !important;
    color: #1d1d1f !important;
    font-size: 13px !important;
    font-weight: 500;
    text-shadow: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06) !important;
}
#noticeModal .modal-footer button:hover {
    background: #fff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
}
#noticeModal .modal-footer button.guide-primary {
    background: var(--theme) !important;
    border-color: var(--theme) !important;
    color: #fff !important;
    font-weight: 600;
}
#noticeModal .modal-footer button.guide-primary:hover { filter: brightness(1.06); }
@media (max-width: 560px) {
    .guide-body { padding: 12px 14px !important; }
    .guide-figure img { border-radius: 10px; }
}

/* ===== 「打开方式 → 捷径显示位置」：macOS 分段控件 ===== */
.seg-control {
    display: inline-flex;
    flex: 0 0 auto;
    padding: 2px;
    gap: 2px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 8px;
}
.seg-control button {
    border: 0;
    background: transparent;
    color: #6e6e73;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.seg-control button.active {
    background: #fff;
    color: var(--theme);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
}
@media (max-width: 560px) {
    .settings-row:has(.seg-control) { flex-wrap: wrap; }
    .seg-control { margin-left: auto; }
}

/* ===== 桌面显示：去掉捷径窗口外壳，只留一块纯透明图标区 =====
   图标区落在搜索框下方，跟着「布局 → 上下位置」的 --layout-shift 一起移动，
   既不会盖住时间 / 搜索框，也不会压住底部的一言和页脚。
   z-index 10 低于搜索容器的 20：搜索联想下拉展开时仍盖在图标之上。 */
body.shortcuts-desktop #contextMenu {
    min-height: 0;
    max-height: none;
    /* top / height 由 applyLayoutPosition() 按搜索框的真实位置算出，
       直接跟随「布局 → 上下位置」的位移；下方空间不足时高度收敛到 0，
       绝不会盖住搜索框或底部的一言 */
    top: var(--desktop-area-top, 55dvh);
    bottom: auto;
    height: var(--desktop-area-h, 30dvh);
    width: min(92vw, 1000px);
    transform: translateX(-50%);
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    border: 0;
    border-radius: 0;
    z-index: 10;
}
body.shortcuts-desktop #contextMenu .context-menu-header,
body.shortcuts-desktop #contextMenu .context-menu-footer {
    /* .xn-titlebar 自带 display:flex !important，这里必须用同等级才能盖掉 */
    display: none !important;
}
body.shortcuts-desktop .shortcuts-container {
    padding: 6px 4px;
    background: transparent;
    /* 桌面图标：格子尺寸同样由 --shortcut-cell 紧凑计算，一屏能铺开更多图标；
       横向 / 纵向间距统一由 --shortcut-gap 提供，和面板模式共用一套真实间距。 */
    scrollbar-width: none;
}
/* 透明图标区不显示滚动条，滚轮 / 触摸滑动照常可滚，壁纸上更干净 */
body.shortcuts-desktop .shortcuts-container::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}
/* 桌面图标：大卡片区域纯透明，只给「紧贴图标的小方块」垫底板。
   和面板模式共用同一套图标块尺寸，颜色略加深 + 轻微模糊，贴在任意壁纸上都能看清。 */
body.shortcuts-desktop .shortcut-item {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
body.shortcuts-desktop .shortcut-icon-wrap {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    /* 细白边 + 投影把小方块的轮廓勾出来，浅色壁纸上也能看清是有底板的图标 */
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-sizing: border-box;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
/* 悬浮只提亮图标小底板，绝不在壁纸上浮出一整块大卡片 */
body.shortcuts-desktop .shortcut-item:hover {
    background: transparent;
    box-shadow: none;
}
body.shortcuts-desktop .shortcut-item:hover .shortcut-icon-wrap {
    background: rgba(255, 255, 255, 0.46);
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
body.shortcuts-desktop .shortcut-item.placeholder {
    background: rgba(255, 255, 255, 0.1);
    border: 2px dashed rgba(255, 255, 255, 0.35);
}
@media (max-width: 600px) {
    body.shortcuts-desktop .shortcuts-container { padding: 4px; }
    body.shortcuts-desktop .shortcut-name { font-size: 10.5px; }
}

/* 桌面模式的图标块比面板模式小一号；窄屏下两种模式统一用 40px。
   注意 --icon-wrap 定义在 body 上，会盖掉从 :root 继承来的值。 */
body.shortcuts-desktop { --icon-wrap: 42px; }
@media (max-width: 600px) {
    :root { --icon-wrap: 40px; }
    body.shortcuts-desktop { --icon-wrap: 40px; }
}

/* ===== 桌面模式「图标显示 → 时间日期平滑上移 / 隐藏 → 归位」 =====
   位移本身由 JS 叠加进 --layout-shift 与 --desktop-area-top，
   这里只在切换瞬间挂上过渡类，平时不启用，避免拖「上下位置」滑块时发黏。 */
body.xn-lift-anim #clock,
body.xn-lift-anim .search-container {
    transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}
body.xn-lift-anim.shortcuts-desktop #contextMenu {
    transition: top 0.42s cubic-bezier(0.4, 0, 0.2, 1),
                height 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

/* v21 起测量改为「读实际渲染位移再反推占位」，不再临时改样式，
   所以不需要 xn-measuring 这类禁用过渡的补丁；过渡可以完整跑满 0.42s。 */

/* ===== v19：桌面显示「图标出现 / 隐藏」的柔和动画 =====
   出现：卡片逐个淡入上浮；隐藏：卡片逐个淡出下沉。
   v18 的隐藏是「整块图标区 190ms 内一起变透明」，所以显得生硬；
   现在改成逐张错开退场，   总时长约 0.46s，和 0.42s 的时间 / 搜索框归位同步。
   仅桌面模式生效；面板模式的玻璃窗口进出动画见 v20 段。 */
@keyframes xnIconIn {
    from { opacity: 0; transform: translateY(12px) scale(0.86); }
    to   { opacity: 1; transform: none; }
}
@keyframes xnIconOut {
    from { opacity: 1; transform: none; }
    to   { opacity: 0; transform: translateY(10px) scale(0.82); }
}
body.shortcuts-desktop #contextMenu.xn-shortcuts-enter .shortcut-item {
    animation: xnIconIn 0.34s cubic-bezier(0.2, 0.8, 0.25, 1) both;
    /* 逐个错开，超过 16 个后统一延迟，长列表不用等太久 */
    animation-delay: calc(var(--xn-i, 0) * 16ms);
}
/* 退场期间 pointer-events:none，指针事件直接落到壁纸，不会被误判成面板内。
   选择器把 xn-lift-anim 一起带上以压过位移过渡，并显式保留 top / height，
   图标区淡出时位置照样平滑归位；整区不再整块变透明，只轻微下沉。 */
body.shortcuts-desktop #contextMenu.xn-shortcuts-leave,
body.xn-lift-anim.shortcuts-desktop #contextMenu.xn-shortcuts-leave {
    pointer-events: none;
    transform: translateX(-50%) translateY(6px);
    transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1),
                top 0.42s cubic-bezier(0.4, 0, 0.2, 1),
                height 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}
body.shortcuts-desktop #contextMenu.xn-shortcuts-leave .shortcut-item {
    animation: xnIconOut 0.3s cubic-bezier(0.4, 0, 0.7, 1) both;
    animation-delay: calc(var(--xn-i, 0) * 10ms);
}

/* ===== v19：弹窗 / 面板 / 菜单动效 ===== */
@keyframes xnBackdropIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes xnBackdropOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes xnWindowIn {
    from { opacity: 0; transform: translateY(14px) scale(0.965); }
    to   { opacity: 1; transform: none; }
}
@keyframes xnWindowOut {
    from { opacity: 1; transform: none; }
    to   { opacity: 0; transform: translateY(8px) scale(0.975); }
}
.modal.xn-open { animation: xnBackdropIn 0.24s ease both; }
.modal.xn-open > * { animation: xnWindowIn 0.34s cubic-bezier(0.2, 0.8, 0.25, 1) both; }
.modal.xn-closing { pointer-events: none; animation: xnBackdropOut 0.22s ease both; }
.modal.xn-closing > * { animation: xnWindowOut 0.22s ease both; }

/* 设置面板换页：内容淡入 + 轻微上浮；左侧导航选中色平滑过渡 */
@keyframes xnPanelIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}
.settings-panel.active {
    display: block;
    animation: xnPanelIn 0.3s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}
.settings-nav-item { transition: background-color 0.25s ease, color 0.25s ease; }

/* 右键菜单 / 搜索引擎下拉 / 联想面板：出现时不硬切。
   菜单的 keyframes 只位移不改尺寸，placeFixedMenu 量到的宽高才不会被缩放带偏。 */
@keyframes xnMenuIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}
@keyframes xnFadeIn { from { opacity: 0; } to { opacity: 1; } }
.item-context-menu {
    transform-origin: top left;
    animation: xnMenuIn 0.18s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}
/* 联想 / 历史下拉在输入过程中会反复 display 切换，挂动画反而会闪，
   所以只给引擎下拉做淡入。 */
.select-menu { animation: xnFadeIn 0.18s ease both; }

/* ===== v20：捷径面板（玻璃窗口）弹出 / 收起动画 =====
   仅面板模式生效；桌面模式走逐张图标进出，两套互不干扰。
   transform 必须完整保留 translate(-50%, -50%)，否则窗口会跳到左上角。 */
@keyframes xnContextIn {
    from { opacity: 0; transform: translate(-50%, calc(-50% + 14px)) scale(0.965); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes xnContextOut {
    from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    to   { opacity: 0; transform: translate(-50%, calc(-50% + 10px)) scale(0.975); }
}
body:not(.shortcuts-desktop) #contextMenu.xn-context-enter {
    animation: xnContextIn 0.34s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}
body:not(.shortcuts-desktop) #contextMenu.xn-context-leave {
    pointer-events: none;
    animation: xnContextOut 0.24s ease-in both;
}

/* ===== v23：聚焦输入框，主题色沿胶囊边缘「匀速」环绕 1.25 圈后自然消隐 =====
   v19 用 conic-gradient 按「极角」旋转：胶囊直线段上极角几乎不变、
   两端半圆上极角骤变，光点就会在圆角处突然加速、直线段近乎停滞。
   现在换成 SVG 圆角矩形 + stroke-dashoffset：offset 按「路径弧长」线性变化，
   与圆角半径无关，沿整圈严格匀速。16 段错开叠加形成前亮后隐的彗尾，
   drop-shadow 与宽柔光带一并提供泛光；v21 起单圈 1s、光线整体收细。
   v23：跑 1.25 圈而不是整圈 —— 收尾落在路径 1/4 处而非起点，
   不会有「刚绕回原点就结束」的闭合感。
   v24：淡出不再挤在运动末尾那一瞬。整整一圈保持全亮清晰，跑完一圈之后
   才开始逐渐隐去，用 0.6s 缓缓收尽，避免高速运动中突然消失的突兀感。
   v25：转圈再加快一点，单圈 1s → 0.8s（1.25 圈 = 1.0s）。淡出整体按
   比例前移：fade 1.6s → 1.4s、全亮段止点 62.5% → 57.14%（×1.4s = 0.8s，
   仍正好一整圈），淡出窗口仍为 0.6s，「逐渐隐藏」的手感不变。 */
@property --theme { syntax: '<color>'; initial-value: #0a84ff; inherits: true; }
:root { transition: --theme 0.38s ease; }

.xn-ring {
    position: absolute;
    left: -3px;
    top: -3px;
    width: calc(100% + 6px);
    height: calc(100% + 6px);
    overflow: visible;
    pointer-events: none;
    z-index: 3;
    opacity: 0;
    /* 三层柔光：头段最亮，泛光跟着拖尾一起渐隐；浅色玻璃底上也要看得清 */
    filter: drop-shadow(0 0 2px var(--theme))
            drop-shadow(0 0 7px var(--theme))
            drop-shadow(0 0 16px color-mix(in srgb, var(--theme) 78%, transparent));
}
.xn-ring rect {
    fill: none;
    stroke: var(--theme);
    stroke-linecap: round;
    /* 一个周期 = seg + gap > 实际周长，保证整圈只出现一段亮弧 */
    stroke-dasharray: var(--xn-seg, 10px) var(--xn-gap, 1600px);
    stroke-dashoffset: var(--xn-seg-offset, 0px);
}
/* 宽而淡的柔光带：和亮线同弧长同速，负责「泛光」而不是靠外阴影硬撑 */
.xn-ring rect.xn-ring-glow { filter: blur(2px); }
/* 光最前端最亮：加白芯 */
.xn-ring rect.xn-ring-head {
    stroke: color-mix(in srgb, var(--theme) 35%, #fff);
}
@keyframes xnRingRun {
    from { stroke-dashoffset: var(--xn-seg-offset, 0px); }
    to   { stroke-dashoffset: calc(var(--xn-seg-offset, 0px) - var(--xn-laps, 3200px)); }
}
@keyframes xnRingFade {
    0%     { opacity: 0; }
    2%     { opacity: 1; }
    /* 57.14% × 1.4s = 0.8s：单圈提速后，整整一圈跑完之前仍始终全亮 */
    57.14% { opacity: 1; }
    /* 之后 0.6s 才缓缓收尽；ease-in-out 让起步、收尾都慢，不会「啪」地断电 */
    100%   { opacity: 0; }
}
/* 运动与淡出解耦：run 1.0s 匀速跑完 1.25 圈（0.8s/圈，收尾仍在路径 1/4 处），
   fade 1.4s 单独负责亮度。一整圈（0.8s）内完全不淡，转够一圈后才开始逐渐
   隐藏；淡出窗口仍是 0.6s，只是整体随提速前移了 0.2s。 */
.xn-ring.xn-ring-run { animation: xnRingFade 1.4s ease-in-out 1 both; }
.xn-ring.xn-ring-run rect { animation: xnRingRun 1s linear 1 both; }

/* 弹窗里的输入框：轻量版主题色光晕，同样一圈后消失 */
@keyframes xnInputGlow {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--theme) 55%, transparent); }
    35%  { box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme) 40%, transparent); }
    100% { box-shadow: 0 0 0 0 transparent; }
}
.xn-window .shortcut-form-group input:focus {
    animation: xnInputGlow 0.85s ease-out 1 both;
}

/* 尊重系统的「减弱动态效果」：保留必要的显隐，只关掉装饰性动画 */
@media (prefers-reduced-motion: reduce) {
    .modal.xn-open, .modal.xn-open > *, .modal.xn-closing, .modal.xn-closing > *,
    .settings-panel.active, .item-context-menu, .select-menu,
    body:not(.shortcuts-desktop) #contextMenu.xn-context-enter,
    body:not(.shortcuts-desktop) #contextMenu.xn-context-leave,
    .xn-window .shortcut-form-group input:focus { animation-duration: 0.01ms !important; }
    .xn-ring { display: none; }
}
