/* 我的导航 - 主样式（由 index 内联样式拆分） */
:root {
            --background-color: #f8fafc;
            --text-color: #0f172a;
            --card-background: rgba(255, 255, 255, 0.72);
            --card-solid: #ffffff;
            --card-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
            --card-border: rgba(0, 0, 0, 0.05);
            --search-border: rgba(0, 0, 0, 0.06);
            --search-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
            --link-text-color: #475569;
            --add-button-bg: #6366f1;
            --add-button-hover-bg: #4f46e5;
            --icon-background: rgba(255, 255, 255, 0.92);
            --icon-color: #334155;
            --search-icon-color: #94a3b8;
            --engine-icon-inactive-opacity: 0.5;
            --lock-icon-color: #64748b;
            --modal-overlay-bg: rgba(15, 23, 42, 0.45);
            --modal-bg: rgba(255, 255, 255, 0.96);
            --modal-text-color: #1f2937;
            --modal-border-color: rgba(148, 163, 184, 0.35);
            --footer-text-color: #94a3b8;
            --danger-bg: #ef4444;
            --toast-bg: #1e293b;
            --toast-text: #f8fafc;
            --pin-color: #f59e0b;
            --history-hover: rgba(59, 130, 246, 0.08);
            --note-accent: #22c55e;
            --title-color: #0f172a;
            --clock-color: #0f172a;
            --accent: #6366f1;
            --accent-glow: rgba(99, 102, 241, 0.3);
            --glass-bg: rgba(255, 255, 255, 0.6);
            --glass-border: rgba(0, 0, 0, 0.05);
            --blur: 18px;
            --content-width: 640px;
            --page-width: 1100px;
            --body-bg-image: radial-gradient(ellipse at 15% 0%, rgba(99, 102, 241, 0.12), transparent 45%),
                             radial-gradient(ellipse at 85% 10%, rgba(14, 165, 233, 0.08), transparent 42%),
                             radial-gradient(ellipse at 50% 100%, rgba(168, 85, 247, 0.06), transparent 48%);
        }

        [data-theme='dark'] {
            --background-color: #0b1220;
            --text-color: #e5e7eb;
            --card-background: rgba(30, 41, 59, 0.55);
            --card-solid: #1e293b;
            --card-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
            --card-border: rgba(255, 255, 255, 0.08);
            --search-border: rgba(255, 255, 255, 0.1);
            --search-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
            --link-text-color: #94a3b8;
            --add-button-bg: #818cf8;
            --add-button-hover-bg: #a5b4fc;
            --icon-background: rgba(51, 65, 85, 0.85);
            --icon-color: #e2e8f0;
            --search-icon-color: #94a3b8;
            --engine-icon-inactive-opacity: 0.55;
            --lock-icon-color: #94a3b8;
            --modal-overlay-bg: rgba(2, 6, 23, 0.72);
            --modal-bg: rgba(30, 41, 59, 0.96);
            --modal-text-color: #e5e7eb;
            --modal-border-color: rgba(148, 163, 184, 0.2);
            --footer-text-color: #64748b;
            --danger-bg: #f87171;
            --toast-bg: #e2e8f0;
            --toast-text: #0f172a;
            --pin-color: #fbbf24;
            --history-hover: rgba(129, 140, 248, 0.14);
            --note-accent: #4ade80;
            --title-color: #f8fafc;
            --clock-color: #f8fafc;
            --accent: #818cf8;
            --accent-glow: rgba(129, 140, 248, 0.35);
            --glass-bg: rgba(255, 255, 255, 0.06);
            --glass-border: rgba(255, 255, 255, 0.1);
            --body-bg-image: radial-gradient(ellipse at 12% 0%, rgba(99, 102, 241, 0.2), transparent 45%),
                             radial-gradient(ellipse at 88% 8%, rgba(14, 165, 233, 0.12), transparent 42%),
                             radial-gradient(ellipse at 50% 100%, rgba(168, 85, 247, 0.1), transparent 48%);
        }

        * { box-sizing: border-box; }

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

        body {
            font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
            display: flex;
            flex-direction: column;
            justify-content: flex-start;
            align-items: center;
            min-height: 100vh;
            min-height: 100dvh;
            height: auto;
            overflow-x: hidden;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            background-color: var(--background-color);
            background-image: var(--body-bg-image);
            background-attachment: fixed;
            background-size: cover;
            background-position: center;
            color: var(--text-color);
            margin: 0;
            /* 刘海 / Home 条安全区 */
            padding: max(10px, env(safe-area-inset-top))
                     max(12px, env(safe-area-inset-right))
                     max(8px, env(safe-area-inset-bottom))
                     max(12px, env(safe-area-inset-left));
            transition: background-color 0.35s ease, color 0.35s ease;
            -webkit-tap-highlight-color: transparent;
            touch-action: manipulation;
        }

        body.bg-soft {
            --body-bg-image: radial-gradient(ellipse at 18% 12%, rgba(59, 130, 246, 0.2), transparent 48%),
                             radial-gradient(ellipse at 82% 0%, rgba(236, 72, 153, 0.12), transparent 42%),
                             radial-gradient(ellipse at 50% 100%, rgba(34, 197, 94, 0.1), transparent 50%);
        }

        body.bg-soft[data-theme='dark'] {
            --body-bg-image: radial-gradient(ellipse at 15% 8%, rgba(96, 165, 250, 0.18), transparent 46%),
                             radial-gradient(ellipse at 90% 12%, rgba(244, 114, 182, 0.12), transparent 42%),
                             radial-gradient(ellipse at 40% 100%, rgba(74, 222, 128, 0.08), transparent 50%);
        }

        body.bg-mesh {
            --body-bg-image: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, transparent 42%, rgba(251, 191, 36, 0.1) 100%);
        }

        body.bg-mesh[data-theme='dark'] {
            --body-bg-image: linear-gradient(135deg, rgba(96, 165, 250, 0.14) 0%, transparent 45%, rgba(251, 191, 36, 0.08) 100%);
        }

        body.bg-plain {
            --body-bg-image: none;
        }

        .container {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            width: 100%;
            max-width: var(--page-width);
            margin: 0 auto;
            position: relative;
            flex: 1 1 auto;
            justify-content: flex-start;
            /* 至少一屏高，便于中间区垂直居中 */
            min-height: calc(100vh - 24px);
            min-height: calc(100dvh - 24px);
            height: auto;
            max-height: none;
            overflow: visible;
        }

        .search-box,
        .suggest-panel {
            width: 100%;
            max-width: var(--content-width);
        }

        /* 顶栏：始终在页面顶部（标题 + 天气），无实色背景 */
        .topbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 0;
            position: sticky;
            top: 0;
            z-index: 50;
            flex: 0 0 auto;
            width: 100%;
            /* 为右上角固定主题按钮留空 */
            padding: 6px 56px 10px 0;
            background: transparent;
            border: none;
            box-shadow: none;
            animation: fade-up 0.35s ease both;
        }

        /* 中间舞台：时钟 / 搜索 / 书签 垂直居中，可随页面下拉 */
        .main-stage {
            flex: 1 1 auto;
            display: flex;
            flex-direction: column;
            align-items: stretch;
            justify-content: center;
            justify-content: safe center;
            width: 100%;
            min-height: 0;
            padding-top: 12px;
            padding-bottom: 8px;
        }

        @supports not (justify-content: safe center) {
            .main-stage {
                justify-content: center;
            }
        }

        /* PC：时钟/问候/诗词相对搜索框上提，利用上方空白 */
        @media (min-width: 901px) {
            .main-stage {
                justify-content: flex-start;
                padding-top: clamp(28px, 7vh, 88px);
                padding-bottom: 32px;
            }

            .hero {
                margin-top: 0;
                margin-bottom: 4px;
            }

            .clock-block {
                gap: 6px;
                margin-bottom: 4px;
            }

            .clock-time {
                font-size: clamp(2.8rem, 5.5vw, 3.85rem);
            }

            .greeting {
                margin-top: 8px;
            }

            .jinrishici-sentence {
                margin-top: 4px;
                margin-bottom: 0;
            }

            /* 与上方时间块拉开一点呼吸感，搜索框仍偏中上 */
            .search-area {
                margin: clamp(28px, 4.5vh, 48px) auto 20px;
            }

            .links-wrap {
                margin-top: 8px;
            }

            .section-title {
                margin-top: 4px;
            }
        }

        .topbar-left {
            display: flex;
            align-items: center;
            gap: 12px;
            min-width: 0;
            cursor: pointer;
        }

        .topbar-left:hover .personalized-title {
            opacity: 0.8;
        }

        .topbar-logo {
            width: 40px;
            height: 40px;
            border-radius: 12px;
            background: var(--accent);
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.15rem;
            flex-shrink: 0;
            box-shadow: 0 6px 16px var(--accent-glow);
        }

        .personalized-title {
            font-size: 1.5rem;
            font-weight: 600;
            letter-spacing: 0.01em;
            cursor: pointer;
            transition: opacity 0.2s ease;
            text-align: left;
            margin: 0;
            user-select: none;
            line-height: 1.25;
            max-width: 50vw;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            color: var(--title-color);
        }

        .topbar-right {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-shrink: 0;
            position: relative;
            z-index: 80;
        }

        .weather-wrap {
            position: relative;
        }

        /* 天气胶囊（顶栏右侧） */
        .weather-chip {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 6px 14px 6px 10px;
            border-radius: 16px;
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            backdrop-filter: blur(var(--blur));
            -webkit-backdrop-filter: blur(var(--blur));
            cursor: pointer;
            color: var(--text-color);
            font-size: 0.82rem;
            font-weight: 500;
            transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s;
            max-width: min(52vw, 280px);
            user-select: none;
        }

        .weather-chip:hover {
            transform: translateY(-1px);
            box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
        }

        .weather-chip.is-open {
            border-color: rgba(99, 102, 241, 0.45);
            box-shadow: 0 6px 16px var(--accent-glow);
        }

        .weather-chip.is-loading {
            opacity: 0.55;
        }

        .weather-chip.is-error {
            opacity: 0.75;
        }

        .weather-chip .w-icon {
            width: 28px;
            height: 28px;
            object-fit: contain;
            flex-shrink: 0;
        }

        .weather-chip .w-icon-fa {
            width: 28px;
            height: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--accent);
            font-size: 1rem;
            flex-shrink: 0;
        }

        .weather-chip .w-main {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 1px;
            min-width: 0;
            line-height: 1.25;
        }

        .weather-chip .w-temp {
            font-weight: 600;
            font-size: 0.9rem;
            letter-spacing: 0.01em;
            white-space: nowrap;
        }

        .weather-chip .w-meta {
            font-size: 0.72rem;
            color: var(--link-text-color);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 160px;
        }

        .weather-chip .w-spin {
            animation: spin 0.9s linear infinite;
            color: var(--link-text-color);
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        /* 7 日预报：从天气胶囊下滑展开，非弹窗 */
        .weather-dropdown {
            position: absolute;
            top: calc(100% + 10px);
            right: 0;
            width: min(92vw, 540px);
            padding: 0;
            border-radius: 16px;
            background: var(--modal-bg);
            border: 1px solid var(--glass-border);
            box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            z-index: 90;
            opacity: 0;
            visibility: hidden;
            transform: translateY(-10px);
            max-height: 0;
            overflow: hidden;
            pointer-events: none;
            transition: opacity 0.22s ease, transform 0.22s ease, max-height 0.28s ease, visibility 0.22s;
        }

        .weather-dropdown.open {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
            max-height: 260px;
            overflow: visible;
            pointer-events: auto;
            padding: 12px 12px 10px;
        }

        .weather-dropdown-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            margin-bottom: 10px;
            padding: 0 2px;
        }

        .weather-place {
            margin: 0;
            text-align: left;
            font-size: 0.8rem;
            color: var(--link-text-color);
            flex: 1;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .weather-refresh {
            border: none;
            background: transparent;
            color: var(--accent);
            font-size: 0.75rem;
            cursor: pointer;
            padding: 4px 6px;
            border-radius: 6px;
            flex-shrink: 0;
        }

        .weather-refresh:hover {
            background: var(--history-hover);
        }

        .forecast-row {
            display: grid;
            grid-template-columns: repeat(7, minmax(0, 1fr));
            gap: 6px;
        }

        /* 主题：右上角固定（原位置） */
        .theme-toggle {
            position: fixed;
            top: max(12px, env(safe-area-inset-top));
            right: max(12px, env(safe-area-inset-right));
            z-index: 120;
            width: 42px;
            height: 42px;
            min-width: 42px;
            min-height: 42px;
            border-radius: 50%;
            border: 1px solid var(--glass-border);
            background: var(--glass-bg);
            color: var(--text-color);
            backdrop-filter: blur(var(--blur));
            -webkit-backdrop-filter: blur(var(--blur));
            box-shadow: var(--card-shadow);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 1.15rem;
            transition: transform 0.2s ease, box-shadow 0.2s ease;
            /* 避免被系统手势误触 */
            touch-action: manipulation;
        }

        .theme-toggle:hover {
            transform: scale(1.06) rotate(-8deg);
            box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
        }

        .forecast-card {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 2px;
            padding: 8px 4px;
            border-radius: 12px;
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            text-align: center;
            font-size: 0.72rem;
            color: var(--text-color);
            min-width: 0;
        }

        .forecast-card.is-today {
            border-color: var(--accent);
            box-shadow: 0 0 0 1px var(--accent-glow);
            background: rgba(99, 102, 241, 0.08);
        }

        .forecast-card .f-week {
            font-weight: 600;
            font-size: 0.78rem;
        }

        .forecast-card .f-date {
            color: var(--link-text-color);
            font-size: 0.68rem;
        }

        .forecast-card img {
            width: 30px;
            height: 30px;
            object-fit: contain;
            margin: 2px 0;
        }

        .forecast-card .f-wea {
            color: var(--link-text-color);
            font-size: 0.66rem;
            max-width: 100%;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .forecast-card .f-temp {
            font-weight: 600;
            font-size: 0.72rem;
            margin-top: 1px;
            white-space: nowrap;
        }

        /* 中心英雄区：日期胶囊 + 大时钟 + 问候/诗词 */
        .hero {
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
            margin: 12px auto 0;
            width: 100%;
            max-width: var(--content-width);
            flex: 0 0 auto;
            animation: fade-up 0.45s ease 0.04s both;
        }

        .clock-block {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            user-select: none;
            margin-bottom: 6px;
        }

        .clock-date {
            display: inline-flex;
            align-items: center;
            padding: 0;
            background: transparent;
            border: none;
            border-radius: 0;
            font-size: 0.88rem;
            font-weight: 500;
            color: var(--link-text-color);
            letter-spacing: 0.04em;
            white-space: nowrap;
        }

        .clock-date .sep {
            margin: 0 8px;
            opacity: 0.3;
        }

        .clock-time {
            display: flex;
            align-items: center;
            gap: 2px;
            font-size: clamp(2.6rem, 7vw, 3.6rem);
            font-weight: 700;
            line-height: 1;
            letter-spacing: -0.04em;
            font-variant-numeric: tabular-nums;
            color: var(--clock-color);
            font-feature-settings: "tnum";
        }

        .clock-time .colon {
            opacity: 0.5;
            margin: 0 4px;
            transform: translateY(-4px);
            animation: colon-pulse 1s infinite;
        }

        .clock-time .sec {
            font-size: 0.36em;
            font-weight: 600;
            opacity: 0.4;
            margin-left: 10px;
            letter-spacing: 0;
            align-self: flex-end;
            padding-bottom: 0.18em;
        }

        @keyframes colon-pulse {
            0%, 100% { opacity: 0.5; }
            50% { opacity: 0.15; }
        }

        .greeting {
            font-size: 0.92rem;
            color: var(--link-text-color);
            margin: 10px 0 0;
            line-height: 1.4;
        }

        .jinrishici-sentence {
            margin: 6px 0 0;
            font-style: normal;
            color: var(--link-text-color);
            text-align: center;
            font-size: 0.84rem;
            max-width: 100%;
            line-height: 1.5;
            opacity: 0.82;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        .hidden-ui { display: none !important; }

        .search-area {
            display: flex;
            flex-direction: column;
            align-items: center;
            width: 100%;
            max-width: var(--content-width);
            margin: 12px auto 12px;
            position: relative;
            flex: 0 0 auto;
            z-index: 1;
            animation: fade-up 0.5s ease 0.08s both;
        }

        /* 下拉展开时抬高层级，避免与书签叠在一起 */
        .search-area.is-dropdown-open {
            z-index: 80;
        }

        .search-box-wrap {
            position: relative;
            width: 100%;
            max-width: var(--content-width);
            z-index: 2;
        }

        .search-box {
            display: flex;
            align-items: center;
            margin: 0 auto;
            width: 100%;
            height: 52px;
            border: 1px solid var(--glass-border);
            border-radius: 32px;
            padding: 0 16px 0 12px;
            box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
            background: var(--glass-bg);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
            position: relative;
            z-index: 3;
        }

        .search-box:focus-within {
            border-color: rgba(99, 102, 241, 0.45);
            box-shadow: 0 14px 34px var(--accent-glow);
            transform: translateY(-1px);
        }

        @keyframes fade-up {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .search-icon {
            margin-left: 8px;
            fill: var(--search-icon-color);
            color: var(--search-icon-color);
            cursor: pointer;
            flex-shrink: 0;
        }

        .search-icon:hover { fill: var(--text-color); color: var(--text-color); }

        .search-clear {
            display: none;
            margin-left: 6px;
            width: 22px;
            height: 22px;
            border: none;
            border-radius: 50%;
            background: transparent;
            color: var(--search-icon-color);
            cursor: pointer;
            font-size: 0.85rem;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            padding: 0;
        }

        .search-clear.visible { display: flex; }
        .search-clear:hover { color: var(--text-color); }

        /* 搜索引擎：自定义下拉 */
        .engine-select-wrap {
            position: relative;
            flex-shrink: 0;
            margin-right: 8px;
            z-index: 6;
        }

        .engine-select-btn {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            height: 36px;
            min-width: 5.8em;
            max-width: 8em;
            padding: 0 10px;
            border-radius: 24px;
            background: rgba(255, 255, 255, 0.14);
            border: 1px solid var(--glass-border);
            color: var(--text-color);
            font-size: 0.82rem;
            font-weight: 600;
            font-family: inherit;
            cursor: pointer;
            user-select: none;
            transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
            white-space: nowrap;
        }

        [data-theme='light'] .engine-select-btn,
        :root:not([data-theme='dark']) .engine-select-btn {
            background: rgba(15, 23, 42, 0.05);
        }

        .engine-select-btn:hover,
        .engine-select-wrap.is-open .engine-select-btn {
            border-color: rgba(99, 102, 241, 0.5);
            box-shadow: 0 4px 14px rgba(99, 102, 241, 0.15);
        }

        .engine-select-btn .engine-select-icon {
            width: 16px;
            height: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            font-size: 0.95rem;
        }

        .engine-select-btn .engine-select-icon img {
            width: 16px;
            height: 16px;
            object-fit: contain;
            display: block;
        }

        .engine-select-btn .engine-select-label {
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 3.5em;
        }

        .engine-select-btn .engine-select-caret {
            font-size: 0.62rem;
            opacity: 0.55;
            transition: transform 0.2s;
            flex-shrink: 0;
        }

        .engine-select-wrap.is-open .engine-select-caret {
            transform: rotate(180deg);
        }

        .engine-select-menu {
            position: absolute;
            top: calc(100% + 8px);
            left: 0;
            min-width: 140px;
            max-width: 220px;
            padding: 6px;
            margin: 0;
            list-style: none;
            border-radius: 12px;
            background: var(--modal-bg);
            border: 1px solid var(--glass-border);
            box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            z-index: 120;
            display: none;
            max-height: 280px;
            overflow-y: auto;
        }

        .engine-select-wrap.is-open .engine-select-menu {
            display: block;
        }

        .engine-select-item {
            display: flex;
            align-items: center;
            gap: 8px;
            width: 100%;
            padding: 9px 10px;
            border: none;
            border-radius: 8px;
            background: transparent;
            color: var(--text-color);
            font-size: 0.88rem;
            font-family: inherit;
            font-weight: 500;
            cursor: pointer;
            text-align: left;
        }

        .engine-select-item:hover,
        .engine-select-item.is-active {
            background: var(--history-hover);
        }

        .engine-select-item.is-active {
            color: var(--accent);
            font-weight: 600;
        }

        .engine-select-item img {
            width: 16px;
            height: 16px;
            object-fit: contain;
            flex-shrink: 0;
        }

        .engine-select-item i {
            width: 16px;
            text-align: center;
            flex-shrink: 0;
            opacity: 0.85;
        }

        .search-input {
            flex-grow: 1;
            border: none;
            outline: none;
            /* ≥16px 避免 iOS 聚焦自动放大 */
            font-size: 16px;
            background: none;
            color: var(--text-color);
            min-width: 0;
            height: 100%;
        }

        /* 搜索历史 / 建议：同样浮在搜索框下，不与书签抢布局 */
        .suggest-panel {
            position: absolute;
            top: calc(100% + 10px);
            left: 50%;
            transform: translateX(-50%);
            width: 100%;
            max-width: var(--content-width);
            background: var(--modal-bg);
            border: 1px solid var(--glass-border);
            border-radius: 14px;
            box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
            z-index: 45;
            display: none;
            overflow: hidden;
            max-height: min(42vh, 320px);
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            backdrop-filter: blur(18px);
            -webkit-backdrop-filter: blur(18px);
        }

        .suggest-panel.visible { display: block; }

        .suggest-section-title {
            font-size: 0.72rem;
            color: var(--footer-text-color);
            padding: 10px 14px 4px;
            text-transform: none;
        }

        .suggest-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 14px;
            cursor: pointer;
            font-size: 0.92rem;
            color: var(--text-color);
            border: none;
            background: none;
            width: 100%;
            text-align: left;
        }

        .suggest-item:hover,
        .suggest-item.active {
            background: var(--history-hover);
        }

        .suggest-item i {
            width: 18px;
            color: var(--link-text-color);
            text-align: center;
        }

        .suggest-item .suggest-meta {
            margin-left: auto;
            font-size: 0.75rem;
            color: var(--footer-text-color);
        }

        .suggest-clear-row {
            border-top: 1px solid var(--modal-border-color);
            padding: 6px;
            text-align: center;
        }

        .suggest-clear-row button {
            border: none;
            background: none;
            color: var(--link-text-color);
            font-size: 0.8rem;
            cursor: pointer;
            padding: 6px 12px;
        }

        .suggest-clear-row button:hover { color: var(--danger-bg); }

        .filter-hint {
            font-size: 0.78rem;
            color: var(--footer-text-color);
            margin-top: 10px;
            min-height: 1.2em;
            opacity: 0.85;
        }

        .controls-area {
            position: fixed;
            bottom: max(16px, env(safe-area-inset-bottom));
            right: max(14px, env(safe-area-inset-right));
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 12px;
            z-index: 100;
        }

        .control-icon {
            font-size: 1.2rem;
            cursor: pointer;
            color: var(--lock-icon-color);
            line-height: 1;
            width: 44px;
            height: 44px;
            min-width: 44px;
            min-height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            background: var(--card-background);
            border: 1px solid var(--card-border);
            box-shadow: var(--card-shadow);
            backdrop-filter: blur(var(--blur));
            -webkit-backdrop-filter: blur(var(--blur));
            transition: transform 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
            touch-action: manipulation;
        }

        .control-icon:hover {
            transform: scale(1.08) translateY(-1px);
            color: var(--add-button-bg);
            box-shadow: 0 10px 22px rgba(59, 130, 246, 0.18);
        }
        .control-icon.hidden { display: none; }

        /* 焦点模式开启时高亮切换按钮 */
        .control-icon.is-active-focus {
            color: var(--accent);
            border-color: rgba(99, 102, 241, 0.45);
            box-shadow: 0 6px 16px var(--accent-glow);
        }

        .links-section {
            width: 100%;
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
            gap: 12px 10px;
            justify-items: center;
            margin: 0 auto;
            min-height: 0;
            padding-bottom: 4px;
        }

        /* 书签随页面自然流动，整页可下拉；底部为悬浮钮留空 */
        .links-wrap {
            width: 100%;
            max-width: var(--content-width);
            margin: 0 auto;
            flex: 0 0 auto;
            min-height: 0;
            overflow: visible;
            position: relative;
            z-index: 0;
            animation: fade-up 0.55s ease 0.1s both;
            padding-right: 2px;
            /* 为底栏版权 + 右下悬浮钮留空 */
            padding-bottom: 24px;
        }

        .section-title {
            display: flex;
            align-items: center;
            gap: 8px;
            margin: 4px 0 12px;
            user-select: none;
            position: sticky;
            top: 0;
            z-index: 2;
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            padding-bottom: 4px;
        }

        .section-title .bar {
            width: 4px;
            height: 18px;
            background: var(--accent);
            border-radius: 2px;
            flex-shrink: 0;
        }

        .section-title h3 {
            margin: 0;
            font-size: 1.1rem;
            font-weight: 600;
            color: var(--text-color);
        }

        .section-title .count {
            font-size: 0.8rem;
            font-weight: 400;
            color: var(--link-text-color);
            opacity: 0.45;
        }

        .links-empty {
            grid-column: 1 / -1;
            text-align: center;
            color: var(--link-text-color);
            font-size: 0.9rem;
            padding: 16px;
        }

        .link-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            text-decoration: none;
            color: var(--link-text-color);
            font-size: 0.88rem;
            transition: transform 0.22s ease, color 0.2s ease;
            position: relative;
            width: 100%;
            max-width: 100px;
            cursor: pointer;
            user-select: none;
            padding: 8px 4px 6px;
            border-radius: 16px;
        }

        .link-item:hover {
            transform: translateY(-5px);
            color: var(--text-color);
        }
        .link-item.dragging { opacity: 0.45; transform: scale(0.95); }
        .link-item.drag-over {
            outline: 2px dashed var(--add-button-bg);
            outline-offset: 2px;
            border-radius: 16px;
            background: var(--history-hover);
        }

        .link-item.pinned .link-icon {
            box-shadow: 0 0 0 2px var(--pin-color), 0 10px 22px rgba(245, 158, 11, 0.2);
        }

        .pin-badge {
            position: absolute;
            top: -6px;
            left: -4px;
            font-size: 0.65rem;
            color: var(--pin-color);
            z-index: 2;
            filter: drop-shadow(0 1px 1px rgba(0,0,0,0.2));
        }

        .link-icon {
            width: 56px;
            height: 56px;
            border-radius: 16px;
            background: var(--icon-background);
            border: 1px solid var(--card-border);
            display: flex;
            justify-content: center;
            align-items: center;
            box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
            margin-bottom: 8px;
            font-size: 1.65rem;
            color: var(--icon-color);
            overflow: hidden;
            transition: background-color 0.3s, box-shadow 0.25s, transform 0.2s;
        }

        .link-item:hover .link-icon {
            box-shadow: 0 14px 28px rgba(59, 130, 246, 0.16);
            transform: scale(1.04);
        }

        .link-icon img {
            width: 100%;
            height: 100%;
            object-fit: contain;
            border-radius: 16px;
            padding: 8px;
        }

        .link-text {
            max-width: 96px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            text-align: center;
        }

        .link-text mark {
            background: rgba(251, 188, 5, 0.45);
            color: inherit;
            border-radius: 2px;
            padding: 0 1px;
        }

        .delete-link-btn,
        .edit-link-btn,
        .pin-link-btn {
            position: absolute;
            top: -10px;
            width: 20px;
            height: 20px;
            display: none;
            justify-content: center;
            align-items: center;
            font-size: 0.72rem;
            cursor: pointer;
            border-radius: 50%;
            color: white;
            z-index: 3;
        }

        .link-item:hover .delete-link-btn,
        .link-item:hover .edit-link-btn,
        .link-item:hover .pin-link-btn {
            display: flex;
        }

        .delete-link-btn {
            right: -10px;
            background-color: rgba(217, 48, 37, 0.85);
        }

        .edit-link-btn {
            right: 14px;
            background-color: rgba(66, 133, 244, 0.85);
        }

        .pin-link-btn {
            left: -10px;
            background-color: rgba(249, 171, 0, 0.9);
            color: #fff;
        }

        .pin-link-btn.is-pinned {
            background-color: var(--pin-color);
            color: #202124;
        }

        .modal-overlay {
            position: fixed;
            inset: 0;
            background-color: var(--modal-overlay-bg);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 1000;
            visibility: hidden;
            opacity: 0;
            transition: opacity 0.25s ease, visibility 0.25s ease;
            padding: 16px;
        }

        .modal-overlay.visible {
            visibility: visible;
            opacity: 1;
        }

        .modal-content {
            background-color: var(--modal-bg);
            color: var(--modal-text-color);
            padding: 26px;
            border-radius: 18px;
            border: 1px solid var(--card-border);
            box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
            width: 100%;
            max-width: 420px;
            display: flex;
            flex-direction: column;
            max-height: min(90vh, 640px);
            overflow: auto;
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            animation: fade-up 0.28s ease;
        }

        .modal-content.wide { max-width: 480px; }

        .modal-content h2 {
            margin: 0 0 16px;
            font-size: 1.28rem;
            text-align: center;
        }

        .modal-content label {
            margin-bottom: 5px;
            font-weight: 600;
            font-size: 0.88rem;
        }

        .modal-content input[type="text"],
        .modal-content textarea,
        .modal-content select {
            padding: 10px 12px;
            margin-bottom: 12px;
            border: 1px solid var(--modal-border-color);
            border-radius: 8px;
            background-color: var(--card-background);
            color: var(--text-color);
            font-size: 0.95rem;
            font-family: inherit;
            width: 100%;
        }

        .modal-content textarea {
            min-height: 160px;
            resize: vertical;
            line-height: 1.5;
        }

        .modal-content input:focus,
        .modal-content textarea:focus,
        .modal-content select:focus {
            outline: none;
            border-color: var(--add-button-bg);
        }

        .modal-hint {
            font-size: 0.75rem;
            color: var(--link-text-color);
            margin: -6px 0 12px;
            line-height: 1.4;
        }

        .modal-buttons {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            margin-top: 6px;
            flex-wrap: wrap;
        }

        .modal-buttons button {
            padding: 8px 16px;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-size: 0.92rem;
        }

        .modal-buttons .add-btn {
            background-color: var(--add-button-bg);
            color: #fff;
        }

        .modal-buttons .add-btn:hover { background-color: var(--add-button-hover-bg); }

        .modal-buttons .cancel-btn {
            background-color: #ccc;
            color: #333;
        }

        [data-theme='dark'] .modal-buttons .cancel-btn {
            background-color: #5f6368;
            color: #e8eaed;
        }

        .settings-section {
            margin-bottom: 16px;
        }

        .settings-section h3 {
            margin: 0 0 10px;
            font-size: 0.82rem;
            color: var(--link-text-color);
            font-weight: 600;
            letter-spacing: 0.02em;
        }

        .settings-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .settings-list button {
            width: 100%;
            padding: 11px 12px;
            border: 1px solid var(--modal-border-color);
            border-radius: 8px;
            background: var(--card-background);
            color: var(--text-color);
            cursor: pointer;
            font-size: 0.92rem;
            text-align: left;
        }

        .settings-list button:hover { border-color: var(--add-button-bg); }

        .settings-list button i {
            width: 22px;
            margin-right: 8px;
            color: var(--add-button-bg);
        }

        .settings-list .danger-text { color: var(--danger-bg); }
        .settings-list .danger-text i { color: var(--danger-bg); }

        .toggle-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 4px;
            font-size: 0.92rem;
            border-bottom: 1px solid var(--modal-border-color);
        }

        .toggle-row:last-child { border-bottom: none; }

        .switch {
            position: relative;
            width: 42px;
            height: 24px;
            flex-shrink: 0;
        }

        .switch input { opacity: 0; width: 0; height: 0; }

        .switch .slider {
            position: absolute;
            inset: 0;
            background: #ccc;
            border-radius: 24px;
            cursor: pointer;
            transition: 0.2s;
        }

        .switch .slider::before {
            content: '';
            position: absolute;
            width: 18px;
            height: 18px;
            left: 3px;
            top: 3px;
            background: #fff;
            border-radius: 50%;
            transition: 0.2s;
        }

        .switch input:checked + .slider {
            background: var(--add-button-bg);
        }

        .switch input:checked + .slider::before {
            transform: translateX(18px);
        }

        .chip-row {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        .chip {
            padding: 7px 12px;
            border-radius: 20px;
            border: 1px solid var(--modal-border-color);
            background: var(--card-background);
            color: var(--text-color);
            cursor: pointer;
            font-size: 0.85rem;
        }

        .chip.active {
            border-color: var(--add-button-bg);
            background: var(--add-button-bg);
            color: #fff;
        }

        /* 底栏版权：贴底，无实色背景，与页面背景一体 */
        .footer {
            flex: 0 0 auto;
            width: 100%;
            margin: 0;
            padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
            text-align: center;
            font-size: 0.72rem;
            line-height: 1.4;
            color: var(--footer-text-color);
            opacity: 0.75;
            position: sticky;
            bottom: 0;
            z-index: 40;
            background: transparent;
            border: none;
            box-shadow: none;
        }

        .kbd-hint {
            display: none;
        }

        .toast-container {
            position: fixed;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 2000;
            display: flex;
            flex-direction: column;
            gap: 8px;
            pointer-events: none;
            width: min(90vw, 360px);
        }

        .toast {
            background: var(--toast-bg);
            color: var(--toast-text);
            padding: 12px 16px;
            border-radius: 8px;
            font-size: 0.9rem;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
            opacity: 0;
            transform: translateY(-10px);
            transition: opacity 0.25s, transform 0.25s;
            text-align: center;
        }

        .toast.show {
            opacity: 1;
            transform: translateY(0);
        }

        kbd {
            font-family: inherit;
            font-size: 0.7rem;
            padding: 1px 5px;
            border-radius: 4px;
            border: 1px solid var(--search-border);
            background: var(--card-background);
        }

        /* ========== 右侧多便签板 ========== */
        .sticky-notes-board {
            position: fixed;
            right: max(16px, env(safe-area-inset-right));
            top: 50%;
            transform: translateY(-50%);
            z-index: 85;
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: 10px;
            max-height: min(82vh, 720px);
            overflow-x: visible;
            overflow-y: auto;
            padding: 12px 4px 12px 8px;
            -webkit-overflow-scrolling: touch;
            overscroll-behavior: contain;
            scrollbar-width: thin;
        }

        .sticky-notes-board.is-hidden {
            display: none !important;
        }

        #sticky-notes-list {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: 10px;
        }

        .sticky-notes-toolbar {
            display: flex;
            align-items: center;
            gap: 6px;
            margin-bottom: 2px;
        }

        .sticky-notes-toolbar button {
            border: 1px solid var(--glass-border);
            background: var(--glass-bg);
            color: var(--text-color);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border-radius: 999px;
            height: 32px;
            padding: 0 12px;
            font-size: 0.75rem;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 5px;
            box-shadow: var(--card-shadow);
            transition: transform 0.15s, background 0.15s;
        }

        .sticky-notes-toolbar button:hover {
            transform: translateY(-1px);
            background: var(--card-background);
        }

        .sticky-notes-toolbar button:disabled {
            opacity: 0.45;
            cursor: not-allowed;
            transform: none;
        }

        .sticky-note {
            --sticky-bg: #fef08a;
            --sticky-bg-2: #fde047;
            --sticky-ink: #422006;
            --sticky-muted: rgba(66, 32, 6, 0.45);
            --sticky-line: rgba(66, 32, 6, 0.08);
            --sticky-rot: 1.5deg;
            position: relative;
            width: 200px;
            min-width: 180px;
            max-width: 220px;
            display: flex;
            flex-direction: column;
            background:
                linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 28%),
                linear-gradient(165deg, var(--sticky-bg) 0%, var(--sticky-bg-2) 100%);
            color: var(--sticky-ink);
            border-radius: 2px 2px 4px 4px;
            box-shadow:
                2px 4px 0 rgba(0, 0, 0, 0.04),
                8px 14px 24px rgba(15, 23, 42, 0.16),
                0 1px 0 rgba(255, 255, 255, 0.4) inset;
            padding: 16px 12px 10px;
            transform: rotate(var(--sticky-rot));
            transition: transform 0.2s ease, box-shadow 0.2s ease, width 0.2s ease, min-height 0.2s ease;
            flex-shrink: 0;
        }

        /* 颜色用更醒目的实色渐变，避免看起来都一样 */
        .sticky-note[data-color="yellow"] {
            --sticky-bg: #fef08a;
            --sticky-bg-2: #facc15;
            --sticky-ink: #713f12;
            --sticky-muted: rgba(113, 63, 18, 0.5);
            --sticky-line: rgba(113, 63, 18, 0.1);
        }
        .sticky-note[data-color="pink"] {
            --sticky-bg: #fbcfe8;
            --sticky-bg-2: #f472b6;
            --sticky-ink: #831843;
            --sticky-muted: rgba(131, 24, 67, 0.5);
            --sticky-line: rgba(131, 24, 67, 0.1);
        }
        .sticky-note[data-color="mint"] {
            --sticky-bg: #bbf7d0;
            --sticky-bg-2: #4ade80;
            --sticky-ink: #14532d;
            --sticky-muted: rgba(20, 83, 45, 0.5);
            --sticky-line: rgba(20, 83, 45, 0.1);
        }
        .sticky-note[data-color="sky"] {
            --sticky-bg: #bae6fd;
            --sticky-bg-2: #38bdf8;
            --sticky-ink: #0c4a6e;
            --sticky-muted: rgba(12, 74, 110, 0.5);
            --sticky-line: rgba(12, 74, 110, 0.1);
        }
        .sticky-note[data-color="lavender"] {
            --sticky-bg: #e9d5ff;
            --sticky-bg-2: #c084fc;
            --sticky-ink: #581c87;
            --sticky-muted: rgba(88, 28, 135, 0.5);
            --sticky-line: rgba(88, 28, 135, 0.1);
        }
        .sticky-note[data-color="peach"] {
            --sticky-bg: #fed7aa;
            --sticky-bg-2: #fb923c;
            --sticky-ink: #7c2d12;
            --sticky-muted: rgba(124, 45, 18, 0.5);
            --sticky-line: rgba(124, 45, 18, 0.1);
        }

        [data-theme='dark'] .sticky-note {
            box-shadow:
                2px 4px 0 rgba(0, 0, 0, 0.15),
                8px 16px 28px rgba(0, 0, 0, 0.4);
        }

        [data-theme='dark'] .sticky-note[data-color="yellow"] {
            --sticky-bg: #ca8a04;
            --sticky-bg-2: #a16207;
            --sticky-ink: #fef9c3;
            --sticky-muted: rgba(254, 249, 195, 0.55);
            --sticky-line: rgba(254, 249, 195, 0.12);
        }
        [data-theme='dark'] .sticky-note[data-color="pink"] {
            --sticky-bg: #db2777;
            --sticky-bg-2: #9d174d;
            --sticky-ink: #fce7f3;
            --sticky-muted: rgba(252, 231, 243, 0.55);
            --sticky-line: rgba(252, 231, 243, 0.12);
        }
        [data-theme='dark'] .sticky-note[data-color="mint"] {
            --sticky-bg: #16a34a;
            --sticky-bg-2: #166534;
            --sticky-ink: #dcfce7;
            --sticky-muted: rgba(220, 252, 231, 0.55);
            --sticky-line: rgba(220, 252, 231, 0.12);
        }
        [data-theme='dark'] .sticky-note[data-color="sky"] {
            --sticky-bg: #0284c7;
            --sticky-bg-2: #075985;
            --sticky-ink: #e0f2fe;
            --sticky-muted: rgba(224, 242, 254, 0.55);
            --sticky-line: rgba(224, 242, 254, 0.12);
        }
        [data-theme='dark'] .sticky-note[data-color="lavender"] {
            --sticky-bg: #9333ea;
            --sticky-bg-2: #6b21a8;
            --sticky-ink: #f3e8ff;
            --sticky-muted: rgba(243, 232, 255, 0.55);
            --sticky-line: rgba(243, 232, 255, 0.12);
        }
        [data-theme='dark'] .sticky-note[data-color="peach"] {
            --sticky-bg: #ea580c;
            --sticky-bg-2: #c2410c;
            --sticky-ink: #ffedd5;
            --sticky-muted: rgba(255, 237, 213, 0.55);
            --sticky-line: rgba(255, 237, 213, 0.12);
        }

        /* 便签色点（标题旁标识） */
        .sticky-note-color-dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            flex-shrink: 0;
            background: var(--sticky-bg-2);
            box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
        }

        .sticky-note:hover {
            transform: rotate(0deg) scale(1.02);
            z-index: 2;
            box-shadow:
                2px 6px 0 rgba(0, 0, 0, 0.05),
                12px 20px 32px rgba(15, 23, 42, 0.2);
        }

        .sticky-note-pin {
            position: absolute;
            top: -9px;
            left: 50%;
            transform: translateX(-50%);
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: radial-gradient(circle at 35% 30%, #fecaca, #dc2626 55%, #991b1b);
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.35);
            z-index: 2;
            pointer-events: none;
        }

        .sticky-note-head {
            display: flex;
            align-items: center;
            gap: 4px;
            margin-bottom: 6px;
            padding-top: 2px;
            user-select: none;
        }

        .sticky-note-title {
            flex: 1 1 auto;
            min-width: 0;
            border: none;
            outline: none;
            background: transparent;
            color: var(--sticky-ink);
            font-size: 0.8rem;
            font-weight: 700;
            letter-spacing: 0.02em;
            opacity: 0.85;
            padding: 2px 0;
            font-family: inherit;
        }

        .sticky-note-title::placeholder {
            color: var(--sticky-muted);
            font-weight: 600;
        }

        .sticky-note-actions {
            display: flex;
            gap: 1px;
            flex-shrink: 0;
        }

        .sticky-note-actions button {
            border: none;
            background: transparent;
            color: var(--sticky-ink);
            opacity: 0.5;
            cursor: pointer;
            width: 26px;
            height: 26px;
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.72rem;
            padding: 0;
            transition: opacity 0.15s, background 0.15s;
        }

        .sticky-note-actions button:hover {
            opacity: 0.95;
            background: rgba(0, 0, 0, 0.07);
        }

        .sticky-note-body {
            flex: 1 1 auto;
            min-height: 110px;
            max-height: 180px;
            width: 100%;
            border: none;
            outline: none;
            resize: none;
            background:
                repeating-linear-gradient(
                    transparent,
                    transparent 21px,
                    var(--sticky-line) 21px,
                    var(--sticky-line) 22px
                );
            background-attachment: local;
            color: var(--sticky-ink);
            font-family: 'Segoe Print', 'Comic Sans MS', 'KaiTi', 'STKaiti', cursive, system-ui, sans-serif;
            font-size: 0.88rem;
            line-height: 22px;
            padding: 0 2px 4px;
            margin: 0;
        }

        .sticky-note-body::placeholder {
            color: var(--sticky-muted);
            font-style: italic;
        }

        .sticky-note-foot {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-top: 4px;
            font-size: 0.65rem;
            color: var(--sticky-muted);
            user-select: none;
            min-height: 16px;
        }

        .sticky-note-foot .saved {
            opacity: 0;
            transition: opacity 0.3s;
        }

        .sticky-note-foot .saved.show {
            opacity: 1;
            color: #15803d;
        }

        [data-theme='dark'] .sticky-note-foot .saved.show {
            color: #bbf7d0;
        }

        /* 折叠：小标签，点击整卡展开（修复：不再隐藏展开入口） */
        .sticky-note.is-collapsed {
            width: 46px;
            min-width: 46px;
            max-width: 46px;
            min-height: 108px;
            max-height: 108px;
            padding: 22px 6px 10px;
            cursor: pointer;
            align-items: center;
        }

        .sticky-note.is-collapsed:hover {
            transform: rotate(0deg) scale(1.05);
        }

        .sticky-note.is-collapsed .sticky-note-body,
        .sticky-note.is-collapsed .sticky-note-foot,
        .sticky-note.is-collapsed .sticky-note-title,
        .sticky-note.is-collapsed .sticky-note-color-dot,
        .sticky-note.is-collapsed .btn-clear-note,
        .sticky-note.is-collapsed .btn-del-note,
        .sticky-note.is-collapsed .btn-color-note {
            display: none !important;
        }

        .sticky-note.is-collapsed .sticky-note-head {
            flex-direction: column;
            margin: 0;
            padding: 0;
            height: auto;
            width: 100%;
            gap: 8px;
        }

        .sticky-note.is-collapsed .sticky-note-actions {
            flex-direction: column;
        }

        .sticky-note.is-collapsed .btn-collapse-note {
            opacity: 0.85;
            width: 28px;
            height: 28px;
            background: rgba(0, 0, 0, 0.06);
        }

        .sticky-note.is-collapsed .collapse-label {
            display: block;
            writing-mode: vertical-rl;
            letter-spacing: 0.18em;
            font-size: 0.82rem;
            font-weight: 700;
            opacity: 0.75;
            max-height: 72px;
            overflow: hidden;
            text-overflow: ellipsis;
            margin: 0 auto;
        }

        .sticky-note:not(.is-collapsed) .collapse-label {
            display: none;
        }

        /* 宽屏 */
        @media (min-width: 1200px) {
            .sticky-notes-board {
                right: max(24px, calc((100vw - var(--page-width)) / 4 - 12px));
            }
            .sticky-note {
                width: 210px;
                max-width: 210px;
            }
        }

        @media (max-width: 1100px) and (min-width: 769px) {
            .sticky-notes-board {
                right: 10px;
            }
            .sticky-note {
                width: 168px;
                min-width: 150px;
            }
        }

        /* ========== 平板 / 大手机 ========== */
        /* 便签仅 PC 宽屏使用；平板/手机完全隐藏 */
        @media (max-width: 900px) {
            .sticky-notes-board,
            .sticky-notes-board.is-hidden {
                display: none !important;
            }

            #note-icon {
                display: none !important;
            }

            .settings-note-pc-only {
                display: none !important;
            }
        }

        @media (max-width: 768px) {
            :root { --content-width: 100%; }

            .topbar {
                padding-right: 48px;
                margin-bottom: 4px;
                gap: 8px;
            }

            .personalized-title {
                font-size: 1.15rem;
                max-width: min(42vw, 9em);
            }

            .topbar-logo {
                width: 34px;
                height: 34px;
                font-size: 0.95rem;
                border-radius: 10px;
            }
        }

        /* ========== 手机竖屏 ========== */
        @media (max-width: 640px) {
            body {
                padding: max(8px, env(safe-area-inset-top))
                         max(10px, env(safe-area-inset-right))
                         max(6px, env(safe-area-inset-bottom))
                         max(10px, env(safe-area-inset-left));
            }

            .theme-toggle {
                top: max(8px, env(safe-area-inset-top));
                right: max(8px, env(safe-area-inset-right));
                width: 40px;
                height: 40px;
                min-width: 40px;
                min-height: 40px;
                font-size: 1.05rem;
            }

            /* 天气：手机上更紧凑，避免顶栏挤爆 */
            .weather-chip {
                padding: 5px 10px 5px 8px;
                gap: 6px;
                max-width: min(46vw, 168px);
                border-radius: 14px;
                min-height: 40px;
            }

            .weather-chip .w-meta {
                max-width: 100px;
                font-size: 0.68rem;
            }

            .weather-chip .w-temp {
                font-size: 0.82rem;
            }

            .weather-chip .w-icon,
            .weather-chip .w-icon-fa {
                width: 24px;
                height: 24px;
                font-size: 0.9rem;
            }

            /* 下拉：fixed + JS 定位，避免被父级裁切 */
            .weather-dropdown {
                position: fixed;
                left: max(10px, env(safe-area-inset-left));
                right: max(10px, env(safe-area-inset-right));
                width: auto;
                max-width: none;
                z-index: 130;
            }

            .weather-dropdown.open {
                max-height: min(42vh, 280px);
                padding: 12px 10px 10px;
            }

            .forecast-row {
                display: flex;
                overflow-x: auto;
                gap: 6px;
                padding-bottom: 4px;
                -webkit-overflow-scrolling: touch;
                scroll-snap-type: x proximity;
            }

            .forecast-card {
                flex: 0 0 70px;
                scroll-snap-align: start;
                padding: 8px 4px;
            }

            .hero {
                margin-top: 6px;
            }

            .clock-date {
                font-size: 0.78rem;
                letter-spacing: 0.02em;
            }

            .clock-time {
                font-size: clamp(2.2rem, 11vw, 2.85rem);
                letter-spacing: -0.03em;
            }

            .clock-time .sec {
                font-size: 0.32em;
                margin-left: 6px;
            }

            .greeting {
                font-size: 0.82rem;
                margin-top: 6px;
            }

            .jinrishici-sentence {
                font-size: 0.76rem;
                -webkit-line-clamp: 1;
                padding: 0 4px;
            }

            .search-area {
                margin: 8px auto 8px;
            }

            .search-box {
                height: 48px;
                border-radius: 26px;
                padding: 0 12px 0 8px;
            }

            .search-input {
                font-size: 16px; /* 防止 iOS 缩放 */
            }

            .engine-select-btn {
                height: 32px;
                min-width: 5.2em;
                max-width: 7em;
                font-size: 0.78rem;
                padding: 0 8px;
            }

            .suggest-panel {
                max-height: min(36vh, 260px);
            }

            .links-wrap {
                padding-bottom: 16px;
            }

            .links-section {
                grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
                gap: 10px 6px;
            }

            .link-item {
                max-width: 78px;
                padding: 6px 2px 4px;
            }

            .link-icon {
                width: 48px;
                height: 48px;
                font-size: 1.35rem;
                border-radius: 14px;
            }

            .link-text {
                max-width: 74px;
                font-size: 0.74rem;
            }

            /* 编辑/删除按钮在触屏上始终略大、更好点 */
            .delete-link-btn,
            .edit-link-btn,
            .pin-link-btn {
                width: 22px;
                height: 22px;
                font-size: 0.75rem;
            }

            .edit-link-btn { right: 12px; }

            .controls-area {
                bottom: max(10px, env(safe-area-inset-bottom));
                right: max(8px, env(safe-area-inset-right));
                gap: 10px;
            }

            .control-icon {
                width: 42px;
                height: 42px;
                min-width: 42px;
                min-height: 42px;
                font-size: 1.1rem;
            }

            .footer {
                font-size: 0.68rem;
                padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
                opacity: 0.7;
            }

            .topbar {
                padding: 4px 48px 8px 0;
                background: transparent;
            }

            .section-title {
                margin: 2px 0 10px;
            }

            .section-title h3 {
                font-size: 1rem;
            }

            .modal-content {
                padding: 20px 16px;
                max-height: min(88dvh, 640px);
                border-radius: 16px;
            }

            .modal-overlay {
                padding: 12px;
                align-items: flex-end;
            }

            @supports (padding: max(0px)) {
                .modal-overlay {
                    padding-bottom: max(12px, env(safe-area-inset-bottom));
                }
            }

            .suggest-panel {
                max-height: min(40vh, 280px);
                overflow: auto;
                -webkit-overflow-scrolling: touch;
            }

            .filter-hint {
                font-size: 0.72rem;
                min-height: 0;
            }

        }

        /* 很窄的屏（小屏手机） */
        @media (max-width: 380px) {
            .personalized-title {
                max-width: 34vw;
                font-size: 1.05rem;
            }

            .weather-chip .w-meta {
                display: none;
            }

            .weather-chip {
                max-width: none;
                padding: 6px 10px;
            }

            .engine-select-btn {
                min-width: 4.6em;
                max-width: 6em;
            }

            .engine-select-btn .engine-select-icon {
                display: none;
            }

            .links-section {
                grid-template-columns: repeat(4, minmax(0, 1fr));
            }

            .topbar-logo {
                width: 30px;
                height: 30px;
                font-size: 0.85rem;
            }
        }

        /* 横屏手机：悬浮钮横排，避免挡内容 */
        @media (max-height: 480px) and (orientation: landscape) {
            .controls-area {
                flex-direction: row;
                bottom: max(8px, env(safe-area-inset-bottom));
                right: 50%;
                transform: translateX(50%);
                gap: 10px;
            }
            .links-wrap { padding-bottom: 64px; }
        }

        /* 触屏 + 解锁：编辑/删除/置顶常显，不依赖 hover */
        body.is-touch.unlocked .link-item .delete-link-btn,
        body.is-touch.unlocked .link-item .edit-link-btn,
        body.is-touch.unlocked .link-item .pin-link-btn {
            display: flex !important;
            opacity: 0.95;
        }

        /* ========== 工作区 Tabs ========== */
        .workspace-bar {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 8px;
            width: 100%;
            max-width: var(--content-width);
            margin: 0 auto 14px;
        }

        .workspace-chip {
            border: 1px solid var(--glass-border);
            background: var(--glass-bg);
            color: var(--link-text-color);
            border-radius: 999px;
            padding: 6px 14px;
            font-size: 0.82rem;
            font-weight: 600;
            cursor: pointer;
            backdrop-filter: blur(10px);
            transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
        }

        .workspace-chip:hover {
            transform: translateY(-1px);
            color: var(--text-color);
        }

        .workspace-chip.active {
            background: var(--accent);
            border-color: transparent;
            color: #fff;
            box-shadow: 0 6px 16px var(--accent-glow);
        }

        /* —— 焦点模式：简洁 + 垂直居中 —— */
        body.focus-mode .workspace-bar,
        body.focus-mode .links-wrap,
        body.focus-mode .sticky-notes-board,
        body.focus-mode .section-title,
        body.focus-mode #add-link-icon,
        body.focus-mode .kbd-hint,
        body.focus-mode .filter-hint,
        body.focus-mode .ai-summary,
        body.focus-mode .jinrishici-sentence {
            display: none !important;
        }

        body.focus-mode .container {
            min-height: calc(100vh - 24px);
            min-height: calc(100dvh - 24px);
            justify-content: flex-start;
        }

        body.focus-mode .main-stage {
            flex: 1 1 auto;
            display: flex;
            flex-direction: column;
            justify-content: center;
            justify-content: safe center;
            align-items: center;
            padding-top: 0 !important;
            padding-bottom: 0 !important;
            min-height: 0;
            width: 100%;
        }

        body.focus-mode .hero {
            margin: 0 auto 8px;
        }

        body.focus-mode .search-area {
            margin: 12px auto 0 !important;
            width: 100%;
        }

        body.focus-mode .greeting {
            margin-top: 8px;
        }

        body.focus-mode .footer {
            flex: 0 0 auto;
            opacity: 0.55;
        }

        /* 覆盖 PC 常态「靠上」布局，焦点模式始终居中 */
        @media (min-width: 901px) {
            body.focus-mode .main-stage {
                justify-content: center;
                justify-content: safe center;
                padding-top: 0 !important;
                padding-bottom: 0 !important;
            }

            body.focus-mode .search-area {
                margin: 20px auto 0 !important;
            }

            body.focus-mode .clock-time {
                font-size: clamp(3rem, 6vw, 4.2rem);
            }
        }

        /* 移动端焦点模式：更大点击区、更干净 */
        @media (max-width: 900px) {
            body.focus-mode .topbar {
                padding-right: 48px;
            }

            body.focus-mode .main-stage {
                min-height: calc(100dvh - 120px);
            }

            body.focus-mode .clock-time {
                font-size: clamp(2.6rem, 12vw, 3.4rem);
            }

            body.focus-mode .search-box {
                height: 52px;
            }

            body.focus-mode .controls-area {
                /* 精简：焦点模式仍保留命令/焦点/设置/主题，便签已隐藏 */
            }

            body.focus-mode #lock-toggle {
                display: none !important;
            }
        }

        /* ========== 命令面板 ========== */
        .cmd-overlay {
            position: fixed;
            inset: 0;
            z-index: 3000;
            background: rgba(15, 23, 42, 0.45);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            display: none;
            align-items: flex-start;
            justify-content: center;
            padding: 12vh 16px 16px;
        }

        .cmd-overlay.visible {
            display: flex;
        }

        .cmd-panel {
            width: min(560px, 100%);
            background: var(--modal-bg);
            border: 1px solid var(--glass-border);
            border-radius: 16px;
            box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
            overflow: hidden;
            animation: fade-up 0.2s ease;
        }

        .cmd-input-wrap {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 14px 16px;
            border-bottom: 1px solid var(--modal-border-color);
        }

        .cmd-input-wrap i {
            color: var(--accent);
            opacity: 0.9;
        }

        .cmd-input {
            flex: 1;
            border: none;
            outline: none;
            background: transparent;
            color: var(--text-color);
            font-size: 16px;
            font-family: inherit;
        }

        .cmd-kbd {
            font-size: 0.7rem;
            color: var(--footer-text-color);
            border: 1px solid var(--modal-border-color);
            border-radius: 6px;
            padding: 2px 6px;
        }

        .cmd-list {
            max-height: min(50vh, 380px);
            overflow-y: auto;
            padding: 8px;
        }

        .cmd-item {
            display: flex;
            align-items: center;
            gap: 12px;
            width: 100%;
            text-align: left;
            border: none;
            background: transparent;
            color: var(--text-color);
            border-radius: 10px;
            padding: 10px 12px;
            cursor: pointer;
            font-family: inherit;
            font-size: 0.92rem;
        }

        .cmd-item:hover,
        .cmd-item.active {
            background: var(--history-hover);
        }

        .cmd-item i,
        .cmd-item .cmd-ico {
            width: 22px;
            text-align: center;
            color: var(--accent);
            flex-shrink: 0;
        }

        .cmd-item .cmd-meta {
            margin-left: auto;
            font-size: 0.72rem;
            color: var(--footer-text-color);
        }

        .cmd-empty {
            padding: 20px;
            text-align: center;
            color: var(--footer-text-color);
            font-size: 0.88rem;
        }

        .cmd-section {
            font-size: 0.72rem;
            color: var(--footer-text-color);
            padding: 8px 12px 4px;
            font-weight: 600;
        }

        /* ========== AI 摘要条 ========== */
        .ai-summary {
            width: 100%;
            max-width: var(--content-width);
            margin: 0 auto 14px;
            padding: 12px 14px;
            border-radius: 14px;
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            box-shadow: var(--card-shadow);
            backdrop-filter: blur(var(--blur));
            -webkit-backdrop-filter: blur(var(--blur));
            display: flex;
            align-items: flex-start;
            gap: 12px;
            animation: fade-up 0.4s ease both;
        }

        .ai-summary.is-hidden {
            display: none !important;
        }

        .ai-summary-ico {
            width: 36px;
            height: 36px;
            border-radius: 10px;
            background: linear-gradient(135deg, var(--accent), #a855f7);
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            font-size: 0.95rem;
            box-shadow: 0 6px 14px var(--accent-glow);
        }

        .ai-summary-body {
            flex: 1 1 auto;
            min-width: 0;
        }

        .ai-summary-label {
            font-size: 0.72rem;
            font-weight: 700;
            letter-spacing: 0.04em;
            color: var(--accent);
            margin-bottom: 4px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .ai-summary-label .ai-tag {
            font-size: 0.65rem;
            font-weight: 600;
            padding: 1px 6px;
            border-radius: 999px;
            background: rgba(99, 102, 241, 0.12);
            color: var(--accent);
        }

        .ai-summary-text {
            font-size: 0.88rem;
            line-height: 1.55;
            color: var(--text-color);
            word-break: break-word;
        }

        .ai-summary-text.loading {
            color: var(--link-text-color);
            font-style: italic;
        }

        .ai-summary-actions {
            display: flex;
            flex-direction: column;
            gap: 4px;
            flex-shrink: 0;
        }

        .ai-summary-actions button {
            border: none;
            background: transparent;
            color: var(--link-text-color);
            width: 30px;
            height: 30px;
            border-radius: 8px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .ai-summary-actions button:hover {
            background: var(--history-hover);
            color: var(--accent);
        }

        body.focus-mode .ai-summary {
            max-width: min(var(--content-width), 520px);
        }

        /* 设置表单扩展 */
        .settings-fields {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-top: 8px;
        }

        .settings-fields label {
            font-size: 0.78rem;
            font-weight: 600;
            color: var(--link-text-color);
        }

        .settings-fields input[type="text"],
        .settings-fields input[type="password"],
        .settings-fields input[type="url"] {
            padding: 9px 11px;
            border: 1px solid var(--modal-border-color);
            border-radius: 8px;
            background: var(--card-background);
            color: var(--text-color);
            font-size: 0.9rem;
            font-family: inherit;
            width: 100%;
        }

        .settings-fields .field-row {
            display: flex;
            gap: 8px;
        }

        .settings-fields .field-row > * {
            flex: 1;
        }

        .settings-hint {
            font-size: 0.72rem;
            color: var(--footer-text-color);
            line-height: 1.45;
            margin: 4px 0 0;
        }

        .settings-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 10px;
        }

        .settings-actions button {
            border: 1px solid var(--modal-border-color);
            background: var(--card-background);
            color: var(--text-color);
            border-radius: 8px;
            padding: 8px 12px;
            font-size: 0.85rem;
            cursor: pointer;
            font-family: inherit;
        }

        .settings-actions button.primary {
            background: var(--add-button-bg);
            border-color: transparent;
            color: #fff;
        }

        .settings-actions button:hover {
            border-color: var(--accent);
        }

        .sync-status {
            font-size: 0.75rem;
            color: var(--footer-text-color);
            margin-top: 8px;
            min-height: 1.2em;
        }

        .sync-status.ok { color: #16a34a; }
        .sync-status.err { color: var(--danger-bg); }