:root {
            --theme-bg: #ffffff;
            --theme-bg-secondary: #f8fafc;
            --theme-bg-tertiary: #f1f5f9;
            --theme-card-bg: #ffffff;
            --theme-card-bg-hover: #fafafa;
            
            --theme-text-primary: #111827;
            --theme-text-secondary: #4b5563;
            --theme-text-muted: #5E6473;
            --theme-text-weak: #69727E;
            
            --theme-border: #e5e7eb;
            --theme-border-light: #f3f4f6;
            
            --theme-primary: #4f46e5;
            --theme-primary-hover: #4338ca;
            --theme-primary-light: #eef2ff;
            --theme-primary-dark: #3730a3;
            
            --theme-success: #10b981;
            --theme-info: #06b6d4;
            --theme-warning: #f59e0b;
            --theme-danger: #ef4444;
            
            --theme-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
            --theme-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
            --theme-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
            
            --theme-radius-sm: 8px;
            --theme-radius-md: 12px;
            --theme-radius-lg: 16px;
            --theme-radius-full: 9999px;
            
            --theme-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
            
            --theme-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
            
            --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            --card-shadow: var(--theme-shadow-sm);
            --card-hover-shadow: var(--theme-shadow-md);
            --border-radius: var(--theme-radius-md);
            --transition: var(--theme-transition);

            /* 公告区域（各模板可覆盖） */
            --announce-top-bg: linear-gradient(135deg, #fef3c7, #fde68a);
            --announce-top-border: #d97706;
            --announce-top-icon: #d97706;
            --announce-bg: rgba(79, 70, 229, 0.05);
            --announce-border: #4f46e5;
            --announce-icon: #4f46e5;
        }

        [data-bs-theme="dark"] {
            --theme-bg: #0f172a;
            --theme-bg-secondary: #1e293b;
            --theme-bg-tertiary: #334155;
            --theme-card-bg: #1e293b;
            --theme-card-bg-hover: #334155;
            
            --theme-text-primary: #f8fafc;
            --theme-text-secondary: #e2e8f0;
            --theme-text-muted: #94a3b8;
            --theme-text-weak: #8B9CB3;
            
            --theme-border: #334155;
            --theme-border-light: #475569;
            
            --theme-primary: #818cf8;
            --theme-primary-hover: #6366f1;
            --theme-primary-light: rgba(99, 102, 241, 0.15);
            --theme-primary-dark: #4f46e5;
            
            --theme-success: #34d399;
            --theme-info: #22d3ee;
            --theme-warning: #fbbf24;
            --theme-danger: #f87171;
            
            --theme-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
            --theme-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
            --theme-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
        }

        /* 把 Bootstrap 的颜色变量接到主题变量上：
           卡片 / 表格 / 表单 / 下拉 / 分页 / 模态框等基础组件会随所选模板一起变化，
           文字色统一取自主题前景色（已按 WCAG AA 校准对比度），
           避免"主题变了、组件还是默认蓝白"的割裂感。 */
        :root {
            --bs-body-bg: var(--theme-bg);
            --bs-body-color: var(--theme-text-primary);
            --bs-emphasis-color: var(--theme-text-primary);
            --bs-secondary-color: var(--theme-text-muted);
            --bs-tertiary-color: var(--theme-text-weak);
            --bs-secondary-bg: var(--theme-bg-secondary);
            --bs-tertiary-bg: var(--theme-bg-tertiary);
            --bs-border-color: var(--theme-border);
            --bs-border-color-translucent: var(--theme-border);
            --bs-card-bg: var(--theme-card-bg);
            --bs-card-cap-bg: var(--theme-bg-secondary);
            --bs-card-border-color: var(--theme-border);
            --bs-modal-bg: var(--theme-card-bg);
            --bs-dropdown-bg: var(--theme-card-bg);
            --bs-dropdown-border-color: var(--theme-border);
            --bs-dropdown-link-color: var(--theme-text-primary);
            --bs-dropdown-link-hover-bg: var(--theme-bg-secondary);
            --bs-table-color: var(--theme-text-primary);
            --bs-table-border-color: var(--theme-border);
            --bs-table-striped-bg: var(--theme-bg-secondary);
            --bs-table-striped-color: var(--theme-text-primary);
            --bs-table-hover-bg: var(--theme-bg-secondary);
            --bs-table-hover-color: var(--theme-text-primary);
            --bs-link-color: var(--theme-primary);
            --bs-link-hover-color: var(--theme-primary-hover);
            --bs-pagination-bg: var(--theme-card-bg);
            --bs-pagination-color: var(--theme-text-primary);
            --bs-pagination-border-color: var(--theme-border);
            --bs-pagination-hover-bg: var(--theme-bg-secondary);
            --bs-pagination-active-bg: var(--theme-primary);
            --bs-pagination-active-border-color: var(--theme-primary);
        }

        body {
            font-family: var(--theme-font-family);
            background-color: var(--theme-bg);
            color: var(--theme-text-primary);
            line-height: 1.6;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        /* 导航栏：header 负责 sticky 悬浮，避免 nav 子元素在某些浏览器渲染环境下的兼容性问题 */
        header {
            position: sticky;
            top: 0;
            z-index: 1030;
        }
        .navbar {
            backdrop-filter: blur(12px);
            background-color: rgba(255, 255, 255, 0.92) !important;
            border-bottom: 1px solid var(--theme-border);
            box-shadow: var(--theme-shadow-sm);
        }

        [data-bs-theme="dark"] .navbar {
            background-color: rgba(15, 23, 42, 0.92) !important;
        }

        .navbar-brand {
            font-weight: 700;
            font-size: 1.3rem;
            background: linear-gradient(135deg, var(--theme-primary), var(--theme-primary-dark));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .nav-link {
            font-weight: 500;
            padding: 0.5rem 1rem !important;
            border-radius: var(--theme-radius-sm);
            color: var(--theme-text-secondary) !important;
            transition: var(--theme-transition);
        }

        .nav-link:hover, .nav-link.active {
            color: var(--theme-primary) !important;
            background-color: var(--theme-primary-light);
        }

        /* 主题切换按钮 */
        .theme-toggle {
            width: 42px;
            height: 42px;
            border-radius: 50%;
            border: none;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: var(--theme-transition);
            background: var(--theme-bg-tertiary);
            color: var(--theme-text-secondary);
        }

        .theme-toggle:hover {
            background: var(--theme-primary-light);
            color: var(--theme-primary);
            transform: rotate(20deg);
        }

        /* 主页模式切换按钮 */
        .home-mode-toggle {
            font-size: 0.8rem;
            padding: 4px 10px;
            border-radius: var(--theme-radius-full);
            transition: var(--theme-transition);
            background: var(--theme-bg-tertiary);
            color: var(--theme-text-secondary);
            border: 1px solid var(--theme-border);
        }

        .home-mode-toggle:hover {
            background: var(--theme-primary);
            color: #fff;
            border-color: var(--theme-primary);
        }

        /* 分类卡片 */
        .category-card {
            background: var(--theme-card-bg);
            border: 1px solid var(--theme-border);
            border-radius: var(--theme-radius-md);
            box-shadow: var(--theme-shadow-sm);
            transition: var(--theme-transition);
            overflow: hidden;
            content-visibility: auto;
            contain-intrinsic-size: auto 200px;
        }

        .category-card:hover {
            box-shadow: var(--theme-shadow-md);
            transform: translateY(-2px);
            border-color: var(--theme-primary);
        }

        .category-header {
            padding: 16px 20px;
            border-bottom: 1px solid var(--theme-border);
            display: flex;
            align-items: center;
            gap: 10px;
            background: var(--theme-bg-secondary);
        }

        .category-header h5 {
            margin: 0;
            font-weight: 600;
            font-size: 1rem;
            color: var(--theme-text-primary);
        }

        .category-icon {
            width: 32px;
            height: 32px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
            background: linear-gradient(135deg, var(--theme-primary), var(--theme-primary-dark));
            color: white;
        }

        /* 二级分类 */
        .subcategory-section {
            padding: 0 16px;
        }

        .subcategory-title {
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--theme-text-secondary);
            padding: 12px 4px 8px 4px;
            border-bottom: 1px dashed var(--theme-border);
            margin-bottom: 4px;
        }

        /* 网址/文章项 */
        .item-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
            gap: 12px;
            padding: 16px;
        }

        .item-card {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 14px;
            border-radius: var(--theme-radius-sm);
            text-decoration: none;
            color: var(--theme-text-primary);
            transition: var(--theme-transition);
            border: 1px solid transparent;
            background: var(--theme-bg-secondary);
            content-visibility: auto;
            contain-intrinsic-size: auto 52px;
        }

        .item-card:hover {
            background: var(--theme-primary-light);
            border-color: var(--theme-primary);
            text-decoration: none;
            color: var(--theme-text-primary);
            transform: translateX(3px);
        }

        .item-icon {
            width: 28px;
            height: 28px;
            border-radius: 6px;
            object-fit: contain;
            flex-shrink: 0;
        }

        .item-icon.fallback {
            background: linear-gradient(135deg, var(--theme-primary), var(--theme-primary-dark));
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 0.75rem;
            font-weight: 600;
        }

        .item-icon-svg {
            width: 24px;
            height: 24px;
            flex-shrink: 0;
            color: var(--theme-text-weak, #9ca3af);
        }

        .subcat-svg {
            flex-shrink: 0;
        }

        .item-title {
            font-size: 0.85rem;
            font-weight: 500;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            color: var(--theme-text-primary);
        }

        /* 文章卡片样式 */
        .article-item {
            display: block;
            padding: 12px 16px;
            border-radius: var(--theme-radius-sm);
            text-decoration: none;
            color: var(--theme-text-primary);
            transition: var(--theme-transition);
            border: 1px solid transparent;
            background: var(--theme-bg-secondary);
        }

        .article-item:hover {
            background: var(--theme-primary-light);
            border-color: var(--theme-primary);
            text-decoration: none;
            color: var(--theme-text-primary);
        }

        .article-item h6 {
            font-weight: 600;
            font-size: 0.9rem;
            margin-bottom: 4px;
            color: var(--theme-text-primary);
        }

        .article-item p {
            font-size: 0.8rem;
            color: var(--theme-text-muted);
            margin: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        /* 文章网格布局（自适应列数） */
        .article-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
            gap: 12px;
        }
        .article-card {
            min-width: 0;
        }

        /* 平板端：每行 2 个 */
        @media (max-width: 991px) {
            .article-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        /* 手机端：每行 1 个 */
        @media (max-width: 767px) {
            .article-grid {
                grid-template-columns: 1fr;
            }
        }

        /* 空状态 */
        .empty-state {
            text-align: center;
            padding: 60px 20px;
            color: var(--theme-text-muted);
        }

        .empty-state i {
            font-size: 3rem;
            margin-bottom: 16px;
            opacity: 0.6;
            color: var(--theme-text-weak);
        }

        /* 页脚 */
        footer {
            margin-top: 60px;
            padding: 30px 0;
            border-top: 1px solid var(--theme-border);
            text-align: center;
            font-size: 0.85rem;
            color: var(--theme-text-muted);
        }

        footer a {
            color: var(--theme-text-muted);
            transition: var(--theme-transition);
        }

        footer a:hover {
            color: var(--theme-primary);
        }

        /* 平板端优化 (768px - 1024px) */
        @media (min-width: 768px) and (max-width: 1024px) {
            .item-grid {
                grid-template-columns: repeat(4, 1fr);
                gap: 10px;
                padding: 14px;
            }
            .category-header {
                padding: 14px 18px;
            }
            .navbar-brand {
                font-size: 1.2rem;
            }
            .subcategory-section {
                padding: 0 12px;
            }
            .subcategory-title {
                font-size: 0.82rem;
            }
            /* 导航栏按钮 */
            .home-mode-toggle {
                font-size: 0.78rem;
                padding: 4px 10px;
            }
            .lang-selector {
                font-size: 0.78rem;
            }
        }

        /* 移动端优化 (最大 768px) */
        @media (max-width: 768px) {
            /* 导航栏优化 */
            .navbar {
                padding: 0.5rem 0;
            }
            .navbar-brand {
                font-size: 1.1rem;
            }
            .nav-link {
                padding: 0.7rem 1rem !important;
                font-size: 0.95rem;
            }
            .dropdown-menu {
                border-radius: 12px;
                box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
                margin-top: 0.5rem;
            }
            .dropdown-item {
                padding: 0.7rem 1rem;
                font-size: 0.9rem;
            }

            /* 主题切换和语言选择器 */
            .theme-toggle {
                width: 34px;
                height: 34px;
                font-size: 0.9rem;
            }
            .lang-selector {
                min-width: auto;
                font-size: 0.78rem;
                padding: 0.35rem 0.5rem;
            }
            .home-mode-toggle {
                font-size: 0.75rem;
                padding: 3px 8px;
            }

            /* 按钮优化 */
            .btn-sm {
                padding: 0.45rem 0.8rem;
                font-size: 0.82rem;
            }

            /* 分类卡片优化 */
            .category-card {
                margin-bottom: 1rem;
            }
            .category-header {
                padding: 12px 14px;
            }
            .category-header h5 {
                font-size: 0.95rem;
            }
            .category-icon {
                width: 30px;
                height: 30px;
                font-size: 0.9rem;
            }

            /* 网址网格优化 */
            .item-grid {
                grid-template-columns: repeat(3, 1fr);
                gap: 8px;
                padding: 12px;
            }
            .item-card {
                padding: 8px 10px;
                gap: 8px;
            }
            .item-icon {
                width: 26px;
                height: 26px;
            }
            .item-title {
                font-size: 0.78rem;
            }

            /* 二级分类 */
            .subcategory-section {
                padding: 0 8px;
            }
            .subcategory-title {
                font-size: 0.8rem;
                padding: 10px 4px 6px 4px;
            }

            /* 文章列表优化 */
            .article-item {
                padding: 10px 14px;
            }
            .article-item h6 {
                font-size: 0.85rem;
            }
            .article-item p {
                font-size: 0.75rem;
            }

            /* 推荐栏优化 */
            .recommend-bar {
                padding: 12px 12px 14px;
                border-radius: var(--theme-radius-md);
            }
            .recommend-bar-head {
                margin-bottom: 10px;
                padding-bottom: 8px;
            }
            .recommend-bar-label {
                font-size: 0.82rem;
            }
            .recommend-bar-tip {
                display: none;
            }
            .recommend-list {
                gap: 7px;
            }
            .recommend-item {
                padding: 5px 11px 5px 6px;
                font-size: 0.76rem;
                gap: 6px;
            }
            .recommend-item-text {
                max-width: 9em;
            }
            .recommend-item img,
            .recommend-item .fallback-icon {
                width: 18px;
                height: 18px;
            }

            /* 页脚优化 */
            footer {
                margin-top: 40px;
                padding: 20px 0;
            }
            footer .row {
                flex-direction: column;
                text-align: center;
            }
            footer .col-md-6 {
                margin-bottom: 0.5rem;
            }
            footer a {
                display: inline-block;
                margin: 0 0.5rem;
                font-size: 0.8rem !important;
            }

            /* 主内容区 */
            main {
                padding-top: 1rem !important;
                padding-bottom: 1rem !important;
            }
            .container {
                padding-left: 12px;
                padding-right: 12px;
            }

            /* 广告位优化 */
            .ad-slot {
                margin: 0.5rem 0;
            }
        }

        /* 小屏手机优化 (最大 480px) */
        @media (max-width: 480px) {
            /* 更紧凑的网格布局 */
            .item-grid {
                grid-template-columns: repeat(2, 1fr);
                gap: 6px;
                padding: 10px;
            }
            .item-card {
                padding: 6px 8px;
                gap: 6px;
            }
            .item-icon {
                width: 24px;
                height: 24px;
            }
            .item-title {
                font-size: 0.75rem;
            }

            /* 导航栏进一步压缩 */
            .navbar-brand {
                font-size: 1rem;
            }
            .nav-link {
                padding: 0.6rem 0.8rem !important;
                font-size: 0.9rem;
            }
            .home-mode-toggle {
                font-size: 0.7rem;
                padding: 2px 6px;
            }
            .theme-toggle {
                width: 30px;
                height: 30px;
                font-size: 0.85rem;
            }
            .lang-selector {
                font-size: 0.7rem;
                padding: 2px 5px;
            }

            /* 分类头部优化 */
            .category-header {
                padding: 10px 12px;
                gap: 8px;
            }
            .category-header h5 {
                font-size: 0.9rem;
            }
            .category-icon {
                width: 28px;
                height: 28px;
                font-size: 0.85rem;
            }

            /* 二级分类 */
            .subcategory-section {
                padding: 0 4px;
            }
            .subcategory-title {
                font-size: 0.73rem;
                padding: 8px 4px 5px 4px;
            }

            /* 推荐栏优化 */
            .recommend-item {
                padding: 4px 9px 4px 5px;
                font-size: 0.72rem;
            }
            .recommend-item-text {
                max-width: 7.5em;
            }
            .recommend-item img,
            .recommend-item .fallback-icon {
                width: 16px;
                height: 16px;
            }

            /* 按钮优化 */
            .btn-sm {
                padding: 0.4rem 0.75rem;
                font-size: 0.8rem;
            }

            /* 页脚链接 */
            footer a {
                margin: 0 0.3rem;
                font-size: 0.75rem !important;
            }

            /* 广告位 */
            .ad-slot {
                margin: 0.3rem 0;
            }
        }

        /* 超小屏手机优化 (最大 360px) */
        @media (max-width: 360px) {
            .item-grid {
                grid-template-columns: repeat(2, 1fr);
                gap: 4px;
                padding: 8px;
            }
            .item-card {
                padding: 5px 6px;
                gap: 4px;
            }
            .item-icon {
                width: 22px;
                height: 22px;
            }
            .item-title {
                font-size: 0.7rem;
            }
            .category-header {
                padding: 8px 10px;
            }
            .category-header h5 {
                font-size: 0.85rem;
            }
            .subcategory-title {
                font-size: 0.7rem;
                padding: 6px 4px 4px 4px;
            }
            .home-mode-toggle {
                font-size: 0.65rem;
                padding: 2px 5px;
            }
            .lang-selector {
                font-size: 0.65rem;
            }
            .navbar-brand {
                font-size: 0.95rem;
            }
        }

        /* 横屏模式优化 */
        @media (max-height: 500px) and (orientation: landscape) {
            .navbar {
                padding: 0.3rem 0;
            }
            .navbar-brand {
                font-size: 1rem;
            }
            .category-card {
                margin-bottom: 0.75rem;
            }
            .item-grid {
                padding: 8px;
            }
        }

        /* 触摸设备优化 */
        @media (hover: none) and (pointer: coarse) {
            /* 增大点击区域 */
            .item-card {
                min-height: 44px;
            }
            .nav-link,
            .dropdown-item,
            .btn {
                min-height: 44px;
                display: flex;
                align-items: center;
            }
            /* 移除悬停效果 */
            .item-card:hover,
            .category-card:hover {
                transform: none;
            }
            /* 优化触摸反馈 */
            .item-card:active {
                background: rgba(102, 126, 234, 0.1);
                transform: scale(0.98);
            }
        }

        /* 平板/手机端导航栏：站名居中 + 右侧汉堡按钮。
           折叠菜单浮层、搜索、导航网格、分类、工具行的样式，统一见文件后段
           「平板 / 手机端（<992px）：顶部折叠菜单（汉堡菜单）」。 */
        @media (max-width: 991px) {
            .navbar .container {
                position: relative;
            }
        }

        /* 安全区域适配 (iPhone X 及以上) */
        @supports (padding: max(0px)) {
            .navbar {
                padding-top: max(0.5rem, env(safe-area-inset-top));
            }
            footer {
                padding-bottom: max(20px, env(safe-area-inset-bottom));
            }
        }

        /* 移动浏览器兼容性修复 */
        /* 防止 iOS Safari 输入框缩放 */
        input, select, textarea {
            font-size: 16px !important;
        }
        @media (min-width: 768px) {
            input, select, textarea {
                font-size: inherit !important;
            }
        }

        /* 优化触摸滚动 */
        * {
            -webkit-overflow-scrolling: touch;
        }

        /* 防止长按弹出菜单 */
        img, a {
            -webkit-touch-callout: none;
        }

        /* 优化选中效果 */
        ::selection {
            background: rgba(102, 126, 234, 0.3);
        }
        ::-moz-selection {
            background: rgba(102, 126, 234, 0.3);
        }

        /* 修复 iOS 按钮样式 */
        input[type="button"],
        input[type="submit"],
        input[type="reset"],
        button {
            -webkit-appearance: none;
            -moz-appearance: none;
            appearance: none;
        }

        /* 优化滚动条样式 */
        ::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }
        ::-webkit-scrollbar-track {
            background: var(--theme-bg-secondary);
        }
        ::-webkit-scrollbar-thumb {
            background: var(--theme-text-weak);
            border-radius: 3px;
        }
        ::-webkit-scrollbar-thumb:hover {
            background: var(--theme-text-muted);
        }

        /* 防止文本方向问题 */
        [dir="rtl"] {
            text-align: right;
        }

        /* 优化字体渲染 */
        body {
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            text-rendering: optimizeLegibility;
        }

        /* 修复 Flexbox 在旧版浏览器的兼容性 */
        .d-flex {
            display: -webkit-box;
            display: -webkit-flex;
            display: -ms-flexbox;
            display: flex;
        }

        /* 修复 Grid 在旧版浏览器的兼容性 */
        .item-grid {
            display: -ms-grid;
            display: grid;
        }

        /* 优化图片加载 */
        img {
            -ms-interpolation-mode: bicubic;
        }

        /* 防止 iOS 横屏时字体放大 */
        @media screen and (orientation: landscape) {
            body {
                -webkit-text-size-adjust: 100%;
                -ms-text-size-adjust: 100%;
                text-size-adjust: 100%;
            }
        }

        /* 优化动画性能 */
        .item-card,
        .category-card,
        .article-item,
        .notebook-item {
            -webkit-transform: translateZ(0);
            -moz-transform: translateZ(0);
            -ms-transform: translateZ(0);
            -o-transform: translateZ(0);
            transform: translateZ(0);
            -webkit-backface-visibility: hidden;
            -moz-backface-visibility: hidden;
            -ms-backface-visibility: hidden;
            backface-visibility: hidden;
        }

        /* 拖拽排序样式 */
        .sortable-ghost { opacity: 0.4; }
        .sortable-chosen { cursor: grabbing !important; }
        .drag-handle { cursor: grab; color: var(--theme-text-weak); }
        .drag-handle:hover { color: var(--theme-text-secondary); }

        /* Modal增强 */
        .modal-content {
            border: none;
            border-radius: 16px;
            box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
        }

        .modal-header {
            border-bottom: 1px solid var(--theme-border-light);
            padding: 16px 24px;
        }

        .modal-body { padding: 24px; }

        /* 表单增强 */
        .form-control, .form-select {
            border-radius: var(--theme-radius-sm);
            border: 1px solid var(--theme-border);
            padding: 10px 14px;
            transition: var(--theme-transition);
            background: var(--theme-card-bg);
            color: var(--theme-text-primary);
        }

        .form-control:focus, .form-select:focus {
            border-color: var(--theme-primary);
            box-shadow: 0 0 0 3px var(--theme-primary-light);
            outline: none;
        }

        .form-control::placeholder, .form-select::placeholder {
            color: var(--theme-text-weak);
        }

        .btn {
            border-radius: var(--theme-radius-sm);
            font-weight: 500;
            transition: var(--theme-transition);
            box-shadow: none !important;
        }

        .btn-primary {
            background: linear-gradient(135deg, var(--theme-primary), var(--theme-primary-dark));
            border: none;
            color: #fff;
        }

        .btn-primary:hover {
            background: linear-gradient(135deg, var(--theme-primary-hover), var(--theme-primary-dark));
            transform: translateY(-1px);
            color: #fff;
        }

        .btn-sm {
            border-radius: 6px;
            padding: 0.375rem 0.75rem;
        }

        /* VIP徽章 */
        .vip-badge {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            color: white;
            padding: 2px 8px;
            border-radius: 20px;
            font-size: 0.7rem;
            font-weight: 600;
        }

        /* Toast通知 */
        .toast-container { z-index: 1100; }

        /* 语言选择器 */
        .lang-selector {
            min-width: 120px;
        }

        /* 广告位 */
        .ad-slot {
            text-align: center;
            overflow: hidden;
        }
        .ad-slot > .container {
            padding-top: 12px;
            padding-bottom: 12px;
        }

        /* 推荐位（首页推荐网址 / 文章页推荐文章）：卡片 + 胶囊条目 */
        .recommend-bar {
            background: var(--theme-card-bg);
            border: 1px solid var(--theme-border);
            border-radius: var(--theme-radius-lg);
            padding: 14px 16px 16px;
            box-shadow: var(--theme-shadow-sm);
        }
        .recommend-bar-head {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 12px;
            padding-bottom: 10px;
            border-bottom: 1px dashed var(--theme-border-light, var(--theme-border));
        }
        .recommend-bar-label {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-size: 0.88rem;
            font-weight: 700;
            color: var(--theme-text-primary);
            white-space: nowrap;
        }
        .recommend-bar-label i {
            font-size: 0.95rem;
            color: var(--theme-primary);
        }
        .recommend-bar-tip {
            font-size: 0.75rem;
            color: var(--theme-text-weak);
        }
        .recommend-list {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            align-items: center;
        }
        .recommend-item {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 6px 14px 6px 7px;
            border-radius: var(--theme-radius-full, 999px);
            background: var(--theme-bg-secondary);
            border: 1px solid transparent;
            font-size: 0.83rem;
            font-weight: 500;
            line-height: 1.3;
            color: var(--theme-text-primary);
            text-decoration: none;
            transition: background-color .2s ease, border-color .2s ease,
                        color .2s ease, transform .2s ease, box-shadow .2s ease;
        }
        .recommend-item:hover {
            background: var(--theme-primary-light);
            border-color: var(--theme-primary);
            color: var(--theme-primary);
            transform: translateY(-2px);
            box-shadow: 0 6px 14px -10px var(--theme-nav-shadow, rgba(0, 0, 0, .4));
        }
        .recommend-item-text {
            max-width: 12em;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .recommend-item img,
        .recommend-item .fallback-icon {
            width: 22px;
            height: 22px;
            border-radius: 7px;
            object-fit: cover;
            flex-shrink: 0;
            background: var(--theme-card-bg);
            border: 1px solid var(--theme-border-light, var(--theme-border));
        }
        .recommend-item .fallback-icon {
            display: flex;
            align-items: center;
            justify-content: center;
            background: var(--primary-gradient);
            border: 0;
            color: #fff;
            font-size: 0.72rem;
            font-weight: 600;
        }
    /* 返回顶部/底部按钮 */
.back-to-top-btn,
.back-to-bottom-btn {
    position: fixed;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(79, 70, 229, 0.3);
    z-index: 999;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    font-size: 1.2rem;
}
.back-to-top-btn.show,
.back-to-bottom-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.back-to-top-btn {
    bottom: 80px;
}
.back-to-bottom-btn {
    bottom: 25px;
}
.back-to-top-btn:hover,
.back-to-bottom-btn:hover {
    background: var(--theme-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
    color: #fff;
}
.back-to-bottom-btn:hover {
    transform: translateY(2px);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .back-to-top-btn,
    .back-to-bottom-btn {
        display: none !important;
    }
}

/* 未读消息悬浮图标（呼吸闪烁） */
.notice-fab {
    position: fixed;
    right: 80px;
    bottom: 25px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--theme-danger, #f5576c);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 997;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    animation: noticeFabBreath 1.8s ease-in-out infinite;
    user-select: none;
    text-decoration: none;
}
.notice-fab > .bi {
    font-size: 1.5rem;
    line-height: 1;
}
.notice-fab-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 11px;
    background: #fff;
    color: var(--theme-danger, #f5576c);
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
@keyframes noticeFabBreath {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25); }
    50% { transform: scale(1.09); box-shadow: 0 6px 26px rgba(245, 87, 108, 0.55); }
}
@media (prefers-reduced-motion: reduce) {
    .notice-fab { animation: none; }
}
@media (max-width: 768px) {
    .notice-fab {
        right: 16px;
        bottom: 20px;
    }
}

/* ===== 导航栏全站搜索：默认收起为图标，点击展开输入框 ===== */
.nav-search {
    position: relative;
    display: flex;
    align-items: center;
}
.nav-search .search-form {
    width: 0;
    opacity: 0;
    overflow: hidden;
    transition: width .24s ease, opacity .18s ease;
}
.nav-search .search-form .input-group {
    width: 230px;
}
.nav-search.open .search-form {
    width: 230px;
    opacity: 1;
}
.nav-search-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.nav-search.open .nav-search-toggle {
    color: var(--theme-primary, #667eea);
    border-color: var(--theme-primary, #667eea);
}
@media (prefers-reduced-motion: reduce) {
    .nav-search .search-form { transition: none; }
}

/* ===== 导航栏消息图标（未读角标） ===== */
.nav-msg-btn {
    position: relative;
}
.nav-msg-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--theme-danger, #f5576c);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}
/* 折叠菜单里的消息项：角标贴右上，不挤压文字 */
.nav-drawer-tool.nav-msg-btn .nav-msg-badge {
    top: 4px;
    right: 6px;
}
    /* ============ 全局响应式优化 ============ */

/* 容器统一padding */
@media (max-width: 768px) {
    .container, .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* 导航栏优化 */
@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem 0;
    }
    .navbar-brand {
        font-size: 1.1rem;
    }
    .navbar .nav-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }
    .navbar .btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }
    /* 搜索框在移动端全宽 */
    .navbar .search-form {
        width: 100%;
        margin: 0.5rem 0;
    }
    .navbar .search-form input {
        font-size: 0.9rem;
    }
}

/* 首页分类卡片优化 */
@media (max-width: 768px) {
    .category-section {
        margin-bottom: 1.5rem;
    }
    .category-title {
        font-size: 1.05rem;
        padding: 0.5rem 0;
    }
    .link-card {
        padding: 0.6rem;
        margin-bottom: 0.5rem;
    }
    .link-card .link-title {
        font-size: 0.85rem;
    }
    .link-card .link-icon {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 480px) {
    .category-title {
        font-size: 0.95rem;
    }
    .link-card {
        padding: 0.5rem;
    }
    .link-card .link-title {
        font-size: 0.8rem;
    }
    .link-card .link-icon {
        width: 28px;
        height: 28px;
    }
}

/* 分类页优化 */
@media (max-width: 768px) {
    .category-sidebar {
        margin-bottom: 1rem;
    }
    .category-sidebar .list-group-item {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }
    .subcategory-section {
        margin-bottom: 1rem;
    }
    .subcategory-title {
        font-size: 0.9rem;
    }
}

/* 文章页优化 */
@media (max-width: 768px) {
    .article-card {
        margin-bottom: 1rem;
    }
    .article-card .card-img-top {
        height: 160px;
    }
    .article-card .card-title {
        font-size: 0.95rem;
    }
    .article-card .card-text {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .article-card .card-img-top {
        height: 140px;
    }
}

/* 页脚优化 */
@media (max-width: 768px) {
    footer {
        padding: 1.5rem 0;
        font-size: 0.8rem;
    }
    footer .footer-links {
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
    }
    footer .footer-links a {
        font-size: 0.8rem;
        padding: 0.3rem;
    }
}

/* 通用卡片间距优化 */
@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
    }
    .card-body {
        padding: 1rem;
    }
    .card-header {
        padding: 0.75rem 1rem;
    }
    .row.g-4 {
        --bs-gutter-y: 1rem;
        --bs-gutter-x: 0.75rem;
    }
}

/* 表格响应式 */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.85rem;
    }
    .table th, .table td {
        padding: 0.5rem 0.6rem;
        white-space: nowrap;
    }
}

/* 表单元素优化 */
@media (max-width: 768px) {
    .form-control, .form-select {
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem;
    }
    .form-label {
        font-size: 0.85rem;
    }
    .btn {
        font-size: 0.85rem;
        padding: 0.45rem 0.9rem;
    }
    .btn-sm {
        padding: 0.3rem 0.6rem;
        font-size: 0.78rem;
    }
    .btn-lg {
        padding: 0.6rem 1.2rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .form-control, .form-select {
        font-size: 0.85rem;
    }
    .btn {
        font-size: 0.8rem;
    }
}

/* 模态框优化 */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
    }
    .modal-header {
        padding: 0.75rem 1rem;
    }
    .modal-body {
        padding: 1rem;
    }
    .modal-footer {
        padding: 0.75rem 1rem;
    }
    .modal-title {
        font-size: 1.05rem;
    }
}

/* 面包屑优化 */
@media (max-width: 768px) {
    .breadcrumb {
        font-size: 0.8rem;
        flex-wrap: wrap;
    }
}

/* 大标题优化 */
@media (max-width: 768px) {
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.15rem; }
    h4 { font-size: 1.05rem; }
    h5 { font-size: 0.95rem; }
    h6 { font-size: 0.9rem; }
}

@media (max-width: 480px) {
    h1 { font-size: 1.35rem; }
    h2 { font-size: 1.2rem; }
    h3 { font-size: 1.05rem; }
}

/* 友情链接区域响应式 */
@media (max-width: 768px) {
    .friend-links-section {
        text-align: center;
    }
    .friend-links-section .friend-link-item {
        display: inline-block;
        margin: 0.3rem 0.5rem;
    }
}

/* 公告区域响应式 */
@media (max-width: 768px) {
    .announcement-item {
        padding: 0.6rem 0.8rem;
    }
    .announcement-item .announcement-title {
        font-size: 0.9rem;
    }
    .announcement-item .announcement-content {
        font-size: 0.8rem;
    }
}

/* 确保图片不过大 */
img {
    max-width: 100%;
    height: auto;
}

/* 确保长文本可以换行 */
.text-truncate-responsive {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (max-width: 480px) {
    .text-truncate-responsive {
        max-width: 150px;
    }
}

/* 平板端优化 */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 960px;
    }
    .navbar .nav-link {
        padding: 0.4rem 0.5rem;
        font-size: 0.88rem;
    }
}

/* 小屏手机（360px以下）优化 */
@media (max-width: 360px) {
    .navbar-brand {
        font-size: 1rem;
    }
    .link-card {
        padding: 0.4rem;
    }
    .link-card .link-title {
        font-size: 0.75rem;
    }
    .btn {
        font-size: 0.75rem;
        padding: 0.35rem 0.7rem;
    }
}
    /* 分类折叠 */
.category-collapse-content,
.subcategory-collapse-content {
    transition: all 0.3s ease;
    overflow: hidden;
    will-change: height;
}
.category-collapse-content.collapsed,
.subcategory-collapse-content.collapsed {
    display: none;
}
.collapse-toggle i,
.sub-collapse-toggle i {
    transition: transform 0.3s ease;
}

    /* 性能优化：减少重绘 */
    .smooth-scroll {
        scroll-behavior: smooth;
    }

    /* 移动端性能优化：减少动画 */
    @media (prefers-reduced-motion: reduce) {
        *, *::before, *::after {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
/* ============ 全局防溢出和响应式修复 ============ */

/* 防止任何元素超出屏幕宽度 */
/* 注意：body 不能设置 overflow-x: hidden，否则会破坏 position: sticky 悬浮效果 */
body {
    width: 100%;
    max-width: 100vw;
}

/* 确保所有容器不超出屏幕 */
.container, .container-fluid, .row, [class*="col-"] {
    max-width: 100%;
}

/* 全宽内容区：与首页三栏布局同宽并居中，保证前台页面宽度一致 */
main > .content-fullwidth {
    max-width: 1520px;
    margin-left: auto;
    margin-right: auto;
}

/* 表格防止溢出 */
table {
    width: 100%;
    max-width: 100%;
    table-layout: auto;
}

/* 代码块和pre标签不溢出 */
pre, code {
    white-space: pre-wrap;
    word-break: break-all;
    max-width: 100%;
}

/* 长URL自动换行 */
a, .text-truncate, .link-url {
    word-break: break-all;
    overflow-wrap: break-word;
}

/* 图片不超出容器 */
img, svg, video, canvas {
    max-width: 100%;
    height: auto;
}

/* 固定定位元素不超出屏幕 */
.fixed-bottom, .fixed-top, .position-fixed {
    max-width: 100vw;
}

/* 广告容器不溢出 */
.adsbygoogle, ins {
    max-width: 100% !important;
    overflow: hidden;
}

/* 确保 flex 子元素不溢出 */
.d-flex, .d-inline-flex {
    min-width: 0;
}
.flex-grow-1 {
    min-width: 0;
}

/* 输入框手机端不缩放 */
@media (max-width: 768px) {
    input, select, textarea, button {
        font-size: 16px !important; /* 防止iOS缩放 */
        max-width: 100%;
    }
}

        /* 平板/手机端顶部折叠菜单（汉堡菜单）的样式，统一在下方
           @media (max-width: 991.98px) 及其后的若干媒体查询中维护。
           早前这里还散落着一批指向 .nav-group-card / .navbar-cat-toggle 等
           已废弃结构的规则，既不生效又让排查困难，已一并清理。 */

/* ============================================================
   平板 / 手机端（<992px）：顶部折叠菜单（汉堡菜单）
   ------------------------------------------------------------
   浮层分四块，块与块之间靠"卡片 + 留白"区分，不需要额外标题：
     ① 导航  图标 + 名称的网格卡片（平板 4 列 / 手机 3 列）
     ② 分类  全部分类（一级两列网格，点开后展开其二级）
     ③ 搜索  搜索网址 / 文章（分类下方、工具行上方）
     ④ 工具  主页 / 主题 / 语言 / 账号，等宽一行
   只有浮层本身滚动（单层滚动条），内部不再嵌套滚动区域。
   ============================================================ */
@media (max-width: 991.98px) {
    /* 平板/手机端取消头部 sticky：折叠菜单展开时随页面正常滚动，
       内容再长也不会被视口截断（旧版是 absolute 浮层 + 内部滚动，
       超出一屏的部分看不见也点不到） */
    header {
        position: relative;
        top: auto;
    }
    /* --- 折叠菜单容器：常规文档流，高度自适应完整展开，不做内部滚动 --- */
    .navbar #mainNav.collapse {
        position: static;
        z-index: auto;
        max-height: none;
        overflow: visible;
        margin-top: 8px;
        padding: 10px;
        border: 1px solid var(--theme-border);
        border-radius: 18px;
        background: var(--theme-bg-secondary);
        box-shadow: 0 18px 44px -18px rgba(0, 0, 0, .38);
    }
    /* 块间距（用 margin 而非 flex+gap：折叠展开时不会因布局模式切换而跳动） */
    .navbar #mainNav.collapse.show > * + * {
        margin-top: 10px;
    }

    /* --- ① 搜索 --- */
    .nav-drawer-search {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        height: 46px;
        padding: 0 6px 0 13px;
        border: 1px solid var(--theme-border);
        border-radius: 12px;
        background: var(--theme-card-bg);
        transition: border-color .2s ease, box-shadow .2s ease;
    }
    .nav-drawer-search:focus-within {
        border-color: var(--theme-primary);
        box-shadow: 0 0 0 3px var(--theme-primary-light);
    }
    .nav-drawer-search > i {
        flex-shrink: 0;
        font-size: 1rem;
        color: var(--theme-text-muted);
    }
    .nav-drawer-search input {
        flex: 1;
        min-width: 0;
        height: 100%;
        border: 0;
        outline: 0;
        background: transparent;
        color: var(--theme-text-primary);
    }
    .nav-drawer-search input::placeholder {
        color: var(--theme-text-weak);
    }
    .nav-drawer-search button {
        flex-shrink: 0;
        padding: 8px 14px;
        border: 0;
        border-radius: 9px;
        background: var(--theme-primary);
        color: #fff;
        font-size: .82rem;
        font-weight: 500;
        cursor: pointer;
    }

    /* --- ② 导航：图标 + 名称的网格卡片 --- */
    .navbar #mainNav .navbar-nav {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        width: 100%;
        margin: 0 !important;
        padding: 0;
    }
    .navbar #mainNav .navbar-nav .nav-item {
        margin: 0;
    }
    .navbar #mainNav .navbar-nav .nav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 6px;
        height: 100%;
        padding: 12px 6px !important;
        border: 1px solid var(--theme-border);
        border-radius: 12px;
        background: var(--theme-card-bg);
        color: var(--theme-text-secondary) !important;
        font-size: .78rem;
        font-weight: 500;
        line-height: 1.25;
        text-align: center;
        transition: border-color .2s ease, background-color .2s ease, color .2s ease;
    }
    .navbar #mainNav .navbar-nav .nav-link i {
        margin: 0 !important;
        font-size: 1.2rem;
        line-height: 1;
        color: var(--theme-text-muted);
        transition: color .2s ease;
    }
    .navbar #mainNav .navbar-nav .nav-link:hover,
    .navbar #mainNav .navbar-nav .nav-link.active {
        border-color: var(--theme-primary);
        background: var(--theme-primary-light);
        color: var(--theme-primary) !important;
    }
    .navbar #mainNav .navbar-nav .nav-link:hover i,
    .navbar #mainNav .navbar-nav .nav-link.active i {
        color: var(--theme-primary);
    }
    .navbar #mainNav .navbar-nav .nav-menu-name {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* --- ③ 分类 --- */
    .nav-drawer-cats {
        padding: 2px 2px 4px;
        border: 1px solid var(--theme-border);
        border-radius: 14px;
        background: var(--theme-card-bg);
    }
    .nav-drawer-cats-head {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 11px 12px 9px;
        font-size: .78rem;
        font-weight: 600;
        color: var(--theme-text-muted);
        border-bottom: 1px solid var(--theme-border-light);
    }
    .nav-drawer-cats-head i {
        font-size: .85rem;
    }
    .nav-drawer-cats > .nav-sidebar-menu {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        margin: 0;
        padding: 8px;
        list-style: none;
    }
    .nav-drawer-cats .nav-sidebar-item {
        margin: 0;
    }
    /* 一级分类卡片 */
    .nav-drawer-cats .nav-sidebar-item > .nav-sidebar-link {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 9px 10px;
        border: 1px solid var(--theme-border-light);
        border-radius: 10px;
        background: var(--theme-bg-secondary);
        color: var(--theme-text-primary);
        font-size: .82rem;
        font-weight: 500;
        cursor: pointer;
        transition: border-color .2s ease, background-color .2s ease, color .2s ease;
    }
    .nav-drawer-cats .nav-sidebar-link .sidebar-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 18px;
        height: 18px;
        font-size: .85rem;
        flex-shrink: 0;
    }
    .nav-drawer-cats .nav-sidebar-link .sidebar-icon > i {
        font-size: .9rem;
        line-height: 1;
    }
    .nav-drawer-cats .nav-sidebar-link .sidebar-icon .sidebar-svg {
        width: 16px;
        height: 16px;
    }
    .nav-drawer-cats .nav-sidebar-link .sidebar-icon img {
        width: 16px;
        height: 16px;
    }
    .nav-drawer-cats .nav-sidebar-link .sidebar-name {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .nav-drawer-cats .nav-sidebar-link .sidebar-arrow {
        flex-shrink: 0;
        font-size: .68rem;
    }
    .nav-drawer-cats .nav-sidebar-item.active > .nav-sidebar-link {
        border-color: var(--theme-primary);
        background: var(--theme-primary-light);
        color: var(--theme-primary);
    }
    /* 桌面端选中态是渐变底 + 白字（nav.css），这里选中态是浅底 + 主色字，
       必须把图标与箭头的白色一并改回主色，否则在浅底上看不见。 */
    .nav-drawer-cats .nav-sidebar-item.active > .nav-sidebar-link .sidebar-icon,
    .nav-drawer-cats .nav-sidebar-item.active > .nav-sidebar-link .sidebar-arrow {
        color: var(--theme-primary);
    }
    /* 展开的那一项占满整行，二级直接跟在其下方 */
    .nav-drawer-cats .nav-sidebar-item.open {
        grid-column: 1 / -1;
    }
    /* 二级分类：左侧细分隔线 + 缩进，层级一目了然 */
    .nav-drawer-cats .nav-sidebar-sub {
        margin: 4px 0 2px;
        padding: 4px 0 2px 10px;
        border-left: 2px solid var(--theme-border);
        background: transparent;
        border-radius: 0;
        list-style: none;
    }
    .nav-drawer-cats .nav-sidebar-sub li a {
        display: flex;
        align-items: center;
        gap: 7px;
        padding: 8px 9px;
        border: 0;
        border-radius: 8px;
        color: var(--theme-text-secondary);
        font-size: .8rem;
        text-decoration: none;
        transition: background-color .18s ease, color .18s ease;
    }
    .nav-drawer-cats .nav-sidebar-sub li a:hover,
    .nav-drawer-cats .nav-sidebar-sub li a.active {
        background: var(--theme-primary-light);
        color: var(--theme-primary);
    }
    .nav-drawer-cats .nav-sidebar-sub li a .sub-count {
        margin-left: auto;
        font-size: .72rem;
        color: var(--theme-text-weak);
    }
    /* 分组标题（网址分类 / 文章分类）：横跨整行，与上一组之间用「留白 + 分隔线」明确分区。
       ⚠ 视图里分组标题的类名是 .nav-sidebar-group（与桌面左侧栏同名），
       早前此处误写为 .nav-sidebar-group-title，匹配不到任何元素 ——
       分组标题因此只占网格一格，和分类卡片挤在一起，看起来又紧又乱。
       选择器刻意加深到 .nav-drawer-cats .nav-sidebar-menu > 前缀（0,3,0），
       以稳压 nav.css 里 .nav-sidebar-group:not(:first-child)（0,2,0）的同名规则。 */
    .nav-drawer-cats .nav-sidebar-menu > .nav-sidebar-group,
    .nav-drawer-cats .nav-sidebar-menu > .nav-sidebar-group-title {
        grid-column: 1 / -1;
        display: flex;
        align-items: center;
        gap: 6px;
        margin: 10px 0 0;
        padding: 10px 4px 6px;
        font-size: .74rem;
        font-weight: 700;
        letter-spacing: .02em;
        color: var(--theme-text-muted);
        border-top: 1px solid var(--theme-border);
        border-bottom: 0;
    }
    /* 紧跟在最近/经常访问之后的第一个分组（「网址分类」）不补分隔线 */
    .nav-drawer-cats .nav-sidebar-menu > .nav-sidebar-group:first-child,
    .nav-drawer-cats .nav-sidebar-menu > .nav-sidebar-group-title:first-child {
        margin-top: 0;
        padding-top: 8px;
        border-top: 0;
    }
    .nav-drawer-cats .nav-sidebar-group > i,
    .nav-drawer-cats .nav-sidebar-group-title > i {
        font-size: .85rem;
    }

    /* --- 最近访问 / 经常访问：整行卡片，与下方分类卡片明显区分（点击后定位右侧内容区区块） --- */
    .nav-drawer-cats .nav-quick-item {
        grid-column: 1 / -1;
    }
    .nav-drawer-cats .nav-quick-item > .nav-quick-link {
        border-radius: 10px;
        background: var(--theme-card-bg);
        border: 1px solid var(--theme-border);
    }
    .nav-drawer-cats .nav-quick-divider {
        grid-column: 1 / -1;
        margin: 2px 2px 6px;
    }

    /* --- ④ 工具行：主页 / 主题 / 语言 / 账号 --- */
    .nav-drawer-tools {
        display: flex;
        gap: 8px;
        padding: 8px;
        border: 1px solid var(--theme-border);
        border-radius: 14px;
        background: var(--theme-card-bg);
    }
    .nav-drawer-tools > * {
        flex: 1 1 0;
        min-width: 0;
    }
    .nav-drawer-tool {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        width: 100%;
        padding: 10px 4px;
        border: 0;
        border-radius: 10px;
        background: var(--theme-bg-secondary);
        color: var(--theme-text-secondary);
        font-size: .74rem;
        font-weight: 500;
        line-height: 1.2;
        text-decoration: none;
        cursor: pointer;
        transition: background-color .2s ease, color .2s ease;
    }
    .nav-drawer-tool i {
        font-size: 1.15rem;
        line-height: 1;
        color: var(--theme-text-muted);
        transition: color .2s ease;
    }
    .nav-drawer-tool:hover,
    .nav-drawer-tool:active {
        background: var(--theme-primary-light);
        color: var(--theme-primary);
    }
    .nav-drawer-tool:hover i {
        color: var(--theme-primary);
    }
    .nav-drawer-tool .nav-drawer-tool-text {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    /* 可展开工具按钮（语言 / 账号）右上角的小箭头 */
    .nav-drawer-tools .dropdown > .nav-drawer-tool {
        position: relative;
    }
    .nav-drawer-tool .nav-drawer-tool-caret {
        position: absolute;
        top: 7px;
        right: 7px;
        font-size: .58rem;
        line-height: 1;
        color: var(--theme-text-weak);
    }
    /* 账号按钮上的头像 */
    .nav-drawer-tool .nav-drawer-tool-avatar {
        width: 22px;
        height: 22px;
        border-radius: 50%;
        object-fit: cover;
    }
    /* 工具行里的下拉：覆盖 Bootstrap/Popper 的内联定位，统一贴在按钮下方 */
    .nav-drawer-tools .dropdown {
        position: relative;
        display: flex;
        flex: 1 1 0;
        min-width: 0;
    }
    .nav-drawer-tools .dropdown-menu {
        inset: auto !important;
        top: calc(100% + 6px) !important;
        left: 0 !important;
        right: auto !important;
        /* Popper 定位会写内联 transform，这里一并清掉，统一由上面的 top/left 决定位置 */
        transform: none !important;
        min-width: 160px;
        /* 用户菜单加了「网址/文章/记事本/推广赚钱」多项后最长文案变长，收窄上限避免顶出屏幕 */
        max-width: min(72vw, 240px);
        width: max-content;
        margin: 0;
        padding: 5px;
        border: 1px solid var(--theme-border);
        border-radius: 12px;
        background: var(--theme-card-bg);
        box-shadow: 0 14px 34px -14px rgba(0, 0, 0, .35);
    }
    .nav-drawer-tools .nav-drawer-tool-drop-end .dropdown-menu {
        left: auto !important;
        right: 0 !important;
    }
    .nav-drawer-tools .dropdown-item {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 9px 12px;
        border-radius: 8px;
        font-size: .84rem;
        white-space: nowrap;
    }
    /* 图标固定不压缩，文字超长时截断（多语言下 en/ru 文案较长） */
    .nav-drawer-tools .dropdown-item > .bi {
        flex: 0 0 auto;
    }
    .nav-drawer-tools .dropdown-item > span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .nav-drawer-tools .dropdown-divider {
        margin: 4px 6px;
    }

    /* --- 未登录：登录 / 注册并排 --- */
    .nav-drawer-auth {
        display: flex;
        gap: 8px;
    }
    .nav-drawer-auth .btn {
        flex: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 11px 12px;
        border-radius: 12px;
        font-size: .86rem;
        font-weight: 500;
    }

    /* --- 汉堡按钮：三条线，展开时变成 × --- */
    .navbar-toggler {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        margin-left: auto;
        padding: 0;
        border: 1px solid var(--theme-border);
        border-radius: 12px;
        background: var(--theme-card-bg);
        z-index: 3;
        transition: background-color .2s ease, border-color .2s ease;
    }

    /* --- 顶栏左侧：默认导航 / 我的导航 一键切换 ---
       与汉堡按钮同高、同圆角，三者（切换 / 站名居中 / 汉堡）在同一条水平线上。
       站名是绝对居中的（见下），所以这里只靠 margin-left:auto 把它推到左侧、
       由后面的汉堡按钮吃下剩余空间。 */
    .navbar-home-mode {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        flex-shrink: 0;
        height: 42px;
        margin-right: auto;
        padding: 0 12px;
        border: 1px solid var(--theme-border);
        border-radius: 12px;
        background: var(--theme-card-bg);
        color: var(--theme-text-secondary);
        font-size: .82rem;
        font-weight: 500;
        line-height: 1;
        white-space: nowrap;
        z-index: 3;
        cursor: pointer;
        transition: background-color .2s ease, border-color .2s ease, color .2s ease;
    }
    /* 注意：这里不能写 transform: scale()，否则会生成 containing block，
       .navbar-brand 的 position:absolute;left:50% 居中基准就从容器变成这个按钮。 */
    .navbar-home-mode:active {
        filter: brightness(.96);
    }
    .navbar-home-mode:focus-visible {
        outline: none;
        box-shadow: 0 0 0 3px var(--theme-primary-light);
    }
    /* 当前处于「我的导航」时给个主题色描边，一眼能分辨自己在哪个导航里 */
    .navbar-home-mode.is-my {
        border-color: var(--theme-primary);
        color: var(--theme-primary);
        background: var(--theme-primary-light);
    }
    @media (hover: hover) and (pointer: fine) {
        .navbar-home-mode:hover {
            border-color: var(--theme-primary);
            color: var(--theme-primary);
        }
    }
    /* 极窄屏放不下文字时只留图标（图标本身就是状态指示） */
    @media (max-width: 399.98px) {
        .navbar-home-mode { padding: 0 10px; }
        .navbar-home-mode .navbar-home-mode-text { display: none; }
    }
    .navbar-toggler:focus {
        box-shadow: 0 0 0 3px var(--theme-primary-light);
    }
    .navbar-toggler-icon {
        position: relative;
        width: 18px;
        height: 2px;
        border-radius: 2px;
        background-color: var(--theme-text-primary) !important;
        background-image: none !important;
        transition: background-color .25s ease;
    }
    .navbar-toggler-icon::before,
    .navbar-toggler-icon::after {
        content: '';
        position: absolute;
        left: 0;
        width: 18px;
        height: 2px;
        border-radius: 2px;
        background-color: var(--theme-text-primary);
        transition: transform .25s ease, top .25s ease;
    }
    .navbar-toggler-icon::before { top: -6px; }
    .navbar-toggler-icon::after { top: 6px; }
    .navbar-toggler[aria-expanded="true"] {
        background: var(--theme-primary);
        border-color: var(--theme-primary);
    }
    .navbar-toggler[aria-expanded="true"] .navbar-toggler-icon {
        background-color: transparent !important;
    }
    .navbar-toggler[aria-expanded="true"] .navbar-toggler-icon::before,
    .navbar-toggler[aria-expanded="true"] .navbar-toggler-icon::after {
        background-color: #fff;
    }
    .navbar-toggler[aria-expanded="true"] .navbar-toggler-icon::before {
        top: 0;
        transform: rotate(45deg);
    }
    .navbar-toggler[aria-expanded="true"] .navbar-toggler-icon::after {
        top: 0;
        transform: rotate(-45deg);
    }

    /* --- 站名绝对居中 ---
       注意：#mainNav 折叠菜单也在 .container 内，展开会把容器撑高，
       所以不能用 top:50%（会随抽屉高度漂移到菜单中间），
       必须用固定值锚定顶栏（padding 0.5rem + toggler 42px，顶栏共 58px）。 */
    .navbar .navbar-brand {
        position: absolute;
        top: calc(0.5rem + 21px); /* 顶栏一半：padding 0.5rem + toggler 42px 的一半 */
        left: 50%;
        transform: translate(-50%, -50%);
        margin: 0;
        max-width: 50%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        z-index: 2;
    }
}

/* 平板（768-991）：折叠菜单随文档流居中收窄，导航排 4 列，避免大屏上铺满整屏 */
@media (min-width: 768px) and (max-width: 991.98px) {
    .navbar #mainNav.collapse {
        max-width: 680px;
        margin-left: auto;
        margin-right: auto;
    }
    .navbar #mainNav .navbar-nav {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    .nav-drawer-cats > .nav-sidebar-menu {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* 手机（<768）：进一步收紧间距与字号，保证一屏能看到更多内容 */
@media (max-width: 767.98px) {
    .navbar #mainNav.collapse {
        padding: 8px;
    }
    .navbar #mainNav.collapse.show > * + * {
        margin-top: 8px;
    }
    .navbar #mainNav .navbar-nav {
        gap: 6px;
    }
    .navbar #mainNav .navbar-nav .nav-link {
        padding: 10px 4px !important;
        font-size: .74rem;
    }
    .navbar #mainNav .navbar-nav .nav-link i {
        font-size: 1.1rem;
    }
    .nav-drawer-cats > .nav-sidebar-menu {
        gap: 5px;
        padding: 6px;
    }
    /* 手机端屏幕更窄，分组之间再拉开一点，避免"网址分类 / 文章分类"两组挤在一起 */
    .nav-drawer-cats .nav-sidebar-menu > .nav-sidebar-group,
    .nav-drawer-cats .nav-sidebar-menu > .nav-sidebar-group-title {
        margin-top: 14px;
        padding: 12px 4px 8px;
    }
    .nav-drawer-cats .nav-sidebar-menu > .nav-sidebar-group:first-child,
    .nav-drawer-cats .nav-sidebar-menu > .nav-sidebar-group-title:first-child {
        margin-top: 0;
        padding-top: 10px;
    }
    .nav-drawer-cats .nav-sidebar-item > .nav-sidebar-link {
        padding: 8px 9px;
        font-size: .78rem;
    }
    .nav-drawer-tools {
        gap: 6px;
        padding: 6px;
    }
    .nav-drawer-tool {
        padding: 9px 3px;
        font-size: .7rem;
    }
    .nav-drawer-auth .btn {
        padding: 10px;
        font-size: .82rem;
    }
}

/* 小屏（<400）：站名缩小，避免与汉堡按钮挤在一起 */
@media (max-width: 399.98px) {
    .navbar .navbar-brand {
        font-size: 1rem;
        max-width: 46%;
    }
}

/* 卡片网格在不同设备上的列数 */
@media (min-width: 1400px) {
    .item-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}
@media (min-width: 1200px) and (max-width: 1399px) {
    .item-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}
@media (min-width: 992px) and (max-width: 1199px) {
    .item-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
@media (min-width: 768px) and (max-width: 991px) {
    .item-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (min-width: 480px) and (max-width: 767px) {
    .item-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 479px) {
    .item-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
}

/* 小屏手机进一步优化 */
@media (max-width: 360px) {
    .item-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.35rem;
    }
    .item-card {
        padding: 0.4rem;
    }
    .item-card .item-title {
        font-size: 0.7rem;
    }
    .item-card .item-icon {
        width: 24px;
        height: 24px;
    }
}

/* 模态框在移动端不超出屏幕 */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100vw - 1rem);
    }
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* 下拉菜单不超出屏幕 */
@media (max-width: 768px) {
    .dropdown-menu {
        max-width: 90vw;
        max-height: 60vh;
        overflow-y: auto;
    }
}

/* Toast提示不超出屏幕 */
.toast, .alert {
    max-width: 90vw;
    word-break: break-word;
}

/* 分页按钮移动端优化 */
@media (max-width: 480px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }
    .pagination .page-link {
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* 确保 gap 属性在旧浏览器中也能工作 */
@supports not (gap: 1rem) {
    .row.g-4 > [class*="col-"] {
        margin-bottom: 1.5rem;
    }
}

/* 文章列表页面的响应式 */
@media (max-width: 768px) {
    .article-list-item {
        flex-direction: column;
    }
    .article-list-item .article-thumb {
        width: 100%;
        height: 180px;
    }
}

/* 确保所有按钮在移动端有足够大的点击区域 */
@media (max-width: 768px) {
    .btn, .btn-sm {
        min-height: 36px;
        min-width: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* 页脚内容在移动端不溢出 */
@media (max-width: 768px) {
    footer .row {
        flex-direction: column;
    }
    footer .col-md-4,
    footer .col-md-6 {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
        margin-bottom: 1rem;
    }
}

/* ==================== 全局自适应与暗色主题统一修复 ==================== */

/* 分页/按钮条在窄屏自动换行，防止溢出 */
.d-flex.justify-content-between.align-items-center.mb-3,
.d-flex.justify-content-between.align-items-center.mb-4,
.category-header,
.page-header,
.article-page-header,
.notebook-page-header {
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* 分类标题栏长描述不挤压标题 */
.category-header > *,
.page-header > * {
    min-width: 0;
}
@media (max-width: 768px) {
    .category-header .ms-auto {
        margin-left: 0 !important;
        flex-basis: 100%;
        max-width: 100%;
    }
}

/* 通用分页条换行 */
@media (max-width: 576px) {
    .d-flex.justify-content-center.align-items-center.gap-2 {
        flex-wrap: wrap;
        gap: 0.35rem;
    }
    .page-info {
        font-size: 0.8rem;
    }
}

/* 暗色主题下覆盖硬编码浅色背景 */
[data-bs-theme="dark"] .bg-light,
[data-bs-theme="dark"] .bg-white {
    background-color: var(--theme-bg-secondary) !important;
    color: var(--theme-text-primary) !important;
}

[data-bs-theme="dark"] table.table-light,
[data-bs-theme="dark"] .table-light,
[data-bs-theme="dark"] thead.table-light th {
    background-color: var(--theme-bg-secondary) !important;
    color: var(--theme-text-primary) !important;
}

[data-bs-theme="dark"] .badge.bg-light {
    background-color: var(--theme-bg-tertiary) !important;
    color: var(--theme-text-secondary) !important;
}

/* 暗色主题下内联浅色底与深色文字的兜底规则，已统一收敛到
   /assets/css/components.css，前后台共用同一份，避免重复维护。 */

/* 记事本分类颜色块暗色适配 */
[data-bs-theme="dark"] [class*="notebook-color-"] {
    background-color: var(--theme-bg-secondary) !important;
    color: var(--theme-text-primary) !important;
}

/* 统计图标暗色适配 */
[data-bs-theme="dark"] .stat-icon,
[data-bs-theme="dark"] [class*="stat-icon-"] {
    background-color: var(--theme-bg-tertiary) !important;
}

/* 移动端固定宽链接截断，避免表格溢出 */
@media (max-width: 768px) {
    .link-url,
    .article-url {
        max-width: 45vw !important;
    }
    .table td .text-truncate {
        max-width: 40vw !important;
    }
}

/* 后台/个人中心统计块间距 */
.usage-stat-item {
    background: var(--theme-bg-secondary);
    border: 1px solid var(--theme-border-light);
}
[data-bs-theme="dark"] .usage-stat-item {
    background: var(--theme-bg-secondary);
    border-color: var(--theme-border);
}

/* ============================================================
   首页多引擎搜索（公告栏下方，默认主页 / 我的主页均显示）
   ============================================================ */
.multi-search {
    background: var(--theme-card-bg);
    border: 1px solid var(--theme-border);
    border-radius: 14px;
    padding: 6px 14px 14px;
    box-shadow: var(--theme-shadow-sm);
}
.multi-search-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 20px;
    margin-bottom: 6px;
}
.multi-search-tab {
    position: relative;
    border: 0;
    background: none;
    padding: 9px 2px 7px;
    color: var(--theme-text-secondary);
    font-size: .92rem;
    cursor: pointer;
    transition: color .15s ease;
}
.multi-search-tab:hover { color: var(--theme-text-primary); }
.multi-search-tab.active {
    color: var(--theme-text-primary);
    font-weight: 600;
}
.multi-search-tab.active::after {
    content: '';
    position: absolute;
    left: 18%;
    right: 18%;
    bottom: 0;
    height: 3px;
    border-radius: 3px;
    background: var(--theme-danger, #f5576c);
}
.multi-search-form {
    display: flex;
    align-items: stretch;
}
.multi-search-form input {
    flex: 1;
    min-width: 0;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--theme-border);
    border-right: 0;
    border-radius: 10px 0 0 10px;
    background: var(--theme-bg-secondary);
    color: var(--theme-text-primary);
    outline: none;
    transition: border-color .15s ease;
}
.multi-search-form input:focus { border-color: var(--theme-primary); }
.multi-search-form button {
    width: 66px;
    flex-shrink: 0;
    border: 0;
    border-radius: 0 10px 10px 0;
    background: var(--theme-danger, #f5576c);
    color: #fff;
    font-size: 1.15rem;
    cursor: pointer;
    transition: filter .15s ease;
}
.multi-search-form button:hover { filter: brightness(1.08); }
@media (max-width: 767.98px) {
    .multi-search { padding: 2px 10px 10px; }
    .multi-search-tabs { gap: 2px 14px; }
    .multi-search-tab { font-size: .86rem; padding: 8px 2px 6px; }
}

/* ============================================================
   导航设置面板（齿轮图标弹出）：主题文字选择 + 页面背景图
   ============================================================ */
.nav-settings-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
    z-index: 1090;
}
.nav-settings-backdrop.show {
    opacity: 1;
    visibility: visible;
}
.nav-settings-panel {
    position: fixed;
    top: 64px;
    right: 16px;
    width: 320px;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 88px);
    max-height: calc(100dvh - 88px);
    overflow-y: auto;
    background: var(--theme-card-bg);
    border: 1px solid var(--theme-border);
    border-radius: 16px;
    box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .4);
    z-index: 1091;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
}
.nav-settings-panel.open {
    opacity: 1;
    visibility: visible;
    transform: none;
}
.nav-settings-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--theme-border);
    font-weight: 600;
    color: var(--theme-text-primary);
}
.nav-settings-close {
    border: 0;
    background: none;
    padding: 4px 6px;
    color: var(--theme-text-muted);
    font-size: .95rem;
    cursor: pointer;
}
.nav-settings-close:hover { color: var(--theme-text-primary); }
.nav-settings-body { padding: 14px 16px 16px; }
.nav-settings-label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--theme-text-muted);
    margin-bottom: 8px;
}
.nav-settings-themes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}
.nav-settings-theme-btn {
    padding: 8px 6px;
    border: 1px solid var(--theme-border);
    border-radius: 9px;
    background: var(--theme-bg-secondary);
    color: var(--theme-text-secondary);
    font-size: .8rem;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.nav-settings-theme-btn:hover {
    border-color: var(--theme-primary);
    color: var(--theme-primary);
}
.nav-settings-theme-btn.active {
    border-color: var(--theme-primary);
    background: var(--theme-primary-light);
    color: var(--theme-primary);
    font-weight: 600;
}
#bgImageUrl {
    background: var(--theme-bg-secondary);
    color: var(--theme-text-primary);
    border-color: var(--theme-border);
}
#bgImageUrl::placeholder { color: var(--theme-text-weak); }
.nav-settings-fits {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}
.nav-settings-fits button {
    flex: 1;
    padding: 8px 4px;
    border: 1px solid var(--theme-border);
    border-radius: 9px;
    background: var(--theme-bg-secondary);
    color: var(--theme-text-secondary);
    font-size: .8rem;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.nav-settings-fits button:hover { border-color: var(--theme-primary); color: var(--theme-primary); }
.nav-settings-fits button.active {
    border-color: var(--theme-primary);
    background: var(--theme-primary-light);
    color: var(--theme-primary);
    font-weight: 600;
}
.nav-settings-tip {
    font-size: .72rem;
    color: var(--theme-text-weak);
    margin: 10px 0 0;
}
@media (max-width: 767.98px) {
    .nav-settings-panel {
        top: 70px;
        left: 10px;
        right: 10px;
        width: auto;
    }
}
