/* ============================================
   AI导航系统 - 全局样式 v2
   支持明暗双主题 · 精致UI
   ============================================ */

/* CSS变量 - 亮色主题 */
:root {
    --bg-primary: #f5f7fa;
    --bg-secondary: #f5f7fa;
    --bg-card: #ffffff;
    --bg-header: rgba(255,255,255,0.95);
    --bg-input: #f5f6f8;
    --bg-hover: #f0f2f5;
    --bg-tag: #f0f2f5;
    --bg-section: #ffffff;

    --text-primary: #1a1a2e;
    --text-secondary: #5a6072;
    --text-muted: #9ca3af;
    --text-inverse: #ffffff;

    --border-color: #e5e7eb;
    --border-light: #f0f1f3;

    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-light: rgba(79,70,229,0.08);
    --accent-gradient: linear-gradient(135deg, #4f46e5, #7c3aed);

    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.04), 0 2px 4px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.04);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-card-hover: 0 8px 24px rgba(0,0,0,0.08);
    --shadow-search: 0 4px 20px rgba(0,0,0,0.06);
    --shadow-section: 0 1px 3px rgba(0,0,0,0.04);

    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --header-height: 60px;
    --sidebar-width: 240px;
    --content-max-width: 1440px;

    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.15s ease;
}

/* 暗色主题 */
[data-theme="dark"] {
    --bg-primary: #0a0e1a;
    --bg-secondary: #0f1421;
    --bg-card: #1a2030;
    --bg-card-hover: #232b3d;
    --bg-header: rgba(15,20,33,0.85);
    --bg-input: #1a2030;
    --bg-hover: rgba(255,255,255,0.06);
    --bg-tag: #232b3d;
    --bg-section: #141a28;

    --text-primary: #e8ecf4;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #ffffff;

    --border-color: rgba(255,255,255,0.08);
    --border-light: rgba(255,255,255,0.04);

    --accent: #a78bfa;
    --accent-hover: #8b5cf6;
    --accent-light: rgba(167,139,250,0.15);
    --accent-gradient: linear-gradient(135deg, #a78bfa, #6366f1);

    --shadow-xs: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.5);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.5);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.04);
    --shadow-card-hover: 0 8px 24px rgba(0,0,0,0.5), 0 0 0 1px rgba(167,139,250,0.2);
    --shadow-search: 0 4px 20px rgba(0,0,0,0.4);
    --shadow-section: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.03);
}

/* 基础重置 */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 24px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 主题切换时为所有元素添加平滑过渡 */
.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                fill 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                stroke 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* 页面主体背景特殊处理 - 更长的过渡时间 */
.theme-transitioning body {
    transition: background-color 0.5s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

/* ============================================
   顶部导航栏
   ============================================ */
.header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: var(--bg-header);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: background var(--transition);
}

.header-inner {
    max-width: var(--content-max-width);
    height: 100%;
    margin: 0 auto;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 17px;
    color: var(--text-primary);
    flex-shrink: 0;
    letter-spacing: -0.3px;
}

.logo-icon {
    font-size: 20px;
    color: var(--accent);
}

.header-nav {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
}

.header-nav::-webkit-scrollbar { display: none; }

.nav-link {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 13.5px;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: all var(--transition-fast);
    font-weight: 450;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-link.active {
    color: var(--accent);
    background: var(--accent-light);
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* 主题切换按钮 */
.theme-toggle {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
    box-shadow: var(--shadow-sm);
}

[data-theme="light"] .icon-moon,
:root:not([data-theme]) .icon-moon {
    display: none;
}

[data-theme="dark"] .icon-sun,
[data-theme="dark"] .icon-moon {
    display: block;
}

[data-theme="dark"] .icon-sun {
    display: none;
}

:root:not([data-theme]) .icon-sun {
    display: block;
}

/* ============================================
   搜索区域 - Hero 化
   ============================================ */
.search-section {
    padding: 28px 24px 24px;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 50%, #f5f3ff 100%);
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.search-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -10%;
    width: 60%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(99, 102, 241, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.search-section::after {
    content: '';
    position: absolute;
    bottom: -50%;
    right: -10%;
    width: 50%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(139, 92, 246, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.search-box {
    max-width: 720px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.search-engines {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.engine-btn {
    padding: 5px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13.5px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 450;
}

.engine-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.engine-btn.active {
    background: var(--accent);
    color: var(--text-inverse);
    border-color: var(--accent);
    font-weight: 500;
}

.search-input-wrap {
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid transparent;
    border-radius: 28px;
    padding: 0 6px 0 20px;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
}

.search-input-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 4px 24px rgba(99, 102, 241, 0.15), 0 0 0 4px var(--accent-light);
    background: #fff;
}

.search-icon {
    color: var(--text-muted);
    flex-shrink: 0;
    font-size: 16px;
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 13px 12px;
    font-size: 15px;
    color: var(--text-primary);
    outline: none;
    font-weight: 400;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
    color: #fff;
    border: none;
    border-radius: 22px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.search-btn:hover {
    background: linear-gradient(135deg, var(--accent-hover) 0%, #6d28d9 100%);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
}

/* 搜索建议 */
.search-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 100;
    max-height: 340px;
    overflow-y: auto;
}

.search-suggestions.show {
    display: block;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.suggestion-item:hover {
    background: var(--bg-hover);
}

.suggestion-item .s-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg-tag);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}

.suggestion-item .s-icon img {
    width: 22px;
    height: 22px;
}

.suggestion-item .s-info {
    flex: 1;
    min-width: 0;
}

.suggestion-item .s-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-item .s-desc {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-empty,
.suggestion-error {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}
.suggestion-error {
    color: #ef4444;
}

/* ============================================
   主体区域容器（margin-left 避开固定侧边栏）
   ============================================ */
.page-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* 移动端主题切换按钮（桌面端隐藏） */
.theme-toggle-mobile {
    display: none;
}

/* 移动端汉堡菜单按钮（桌面端隐藏） */
.hamburger-btn {
    display: none;
}

/* 顶部侧边栏收起/展开按钮（已移至右下角悬浮按钮组） */
.top-collapse-btn,
.sidebar-collapse-btn {
    display: none !important;
}

/* 侧边栏遮罩层（桌面端隐藏） */
.sidebar-backdrop {
    display: none;
}

/* ============================================
   主布局
   ============================================ */
.main-layout {
    min-height: calc(100vh - var(--header-height));
}

/* ============================================
   左侧导航栏 - 现代设计
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: #121E2D;
    border-right: 1px solid rgba(255,255,255,0.08);
    overflow-y: auto;
    padding: 0;
    z-index: 200;
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.25);
}

/* 侧边栏顶部 Logo */
.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.2);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.3px;
}

.sidebar-logo i {
    font-size: 36px;
    background: linear-gradient(135deg, #a78bfa 0%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 4px rgba(167,139,250,0.3));
}

.sidebar-logo span {
    font-size: 30px;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #c7d2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 导航区域 */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 12px;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}
.sidebar-nav::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 15px;
    color: rgba(255,255,255,0.75);
    transition: all 0.2s ease;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    text-decoration: none;
}

.sidebar-link i {
    font-size: 14px;
    width: 26px;
    height: 26px;
    line-height: 26px;
    text-align: center;
    flex-shrink: 0;
    color: #fff;
    background: linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04));
    border-radius: 7px;
    transition: all 0.25s ease;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.95);
    transform: translateX(2px);
}

.sidebar-link:hover i {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}

.sidebar-link.active {
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-weight: 600;
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: #fff;
    border-radius: 0 2px 2px 0;
}

.sidebar-link.active i {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}

.sidebar-child i {
    width: auto !important;
    height: auto !important;
    line-height: 1 !important;
    background: none !important;
    box-shadow: none !important;
    font-size: 6px !important;
    color: rgba(255,255,255,0.4) !important;
    margin-right: 4px;
}

.sidebar-child:hover i,
.sidebar-child.active i {
    background: none !important;
    box-shadow: none !important;
    color: #fff !important;
}

/* 二级分类分组 */
.sidebar-group {
    margin-bottom: 2px;
}

.sidebar-parent {
    position: relative;
}

.sidebar-arrow {
    margin-left: auto;
    font-size: 11px !important;
    width: auto !important;
    height: auto !important;
    line-height: 1 !important;
    color: rgba(255,255,255,0.4) !important;
    transition: transform 0.3s ease;
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.sidebar-link .sidebar-arrow {
    background: none !important;
    box-shadow: none !important;
}

.sidebar-group.expanded > .sidebar-parent .sidebar-arrow {
    transform: rotate(180deg);
    color: rgba(255,255,255,0.9) !important;
}

.sidebar-children {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    margin-left: 12px;
    border-left: 1px solid rgba(255,255,255,0.08);
}

.sidebar-group.expanded > .sidebar-children {
    max-height: 1000px;
}

.sidebar-child {
    padding: 8px 16px 8px 20px !important;
    font-size: 13.5px !important;
    color: rgba(255,255,255,0.6) !important;
    border-radius: 0 8px 8px 0 !important;
    margin-left: -1px;
    border-left: 2px solid transparent;
    font-weight: 400 !important;
}

.sidebar-child i {
    font-size: 6px !important;
    width: auto !important;
    color: rgba(255,255,255,0.4) !important;
    margin-right: 4px;
}

.sidebar-child:hover {
    background: rgba(255,255,255,0.05) !important;
    color: rgba(255,255,255,0.95) !important;
    border-left-color: rgba(255,255,255,0.3);
}

.sidebar-child.active {
    background: rgba(255,255,255,0.08) !important;
    color: #fff !important;
    border-left-color: #fff;
    font-weight: 500 !important;
}

.sidebar-child.active::before {
    display: none !important;
}

.sidebar.collapsed .sidebar-arrow,
.sidebar.collapsed .sidebar-children {
    display: none;
}

/* 侧边栏底部主题切换 */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(0,0,0,0.15);
}

.sidebar-footer .theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.sidebar-footer .theme-toggle:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-color: rgba(167,139,250,0.4);
    transform: scale(1.05);
}

.sidebar-footer .theme-toggle i {
    font-size: 18px;
}

/* 侧边栏子分类 */
.sidebar-sub {
    padding-left: 26px;
    margin-bottom: 4px;
}

.sidebar-sublink {
    display: block;
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 12.5px;
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-sublink:hover {
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.8);
}

.sidebar-sublink.active {
    color: #a78bfa;
    font-weight: 500;
}

.sidebar-footer .theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.55);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.sidebar-footer .theme-toggle:hover {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.9);
    border-color: rgba(255,255,255,0.2);
}

/* ========== 侧边栏收起/展开 ========== */
.sidebar {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 防止页面加载时侧边栏闪烁 - 桌面端 */
.sidebar-preload-collapsed .sidebar {
    width: 64px;
}
.sidebar-preload-collapsed .sidebar .sidebar-logo span,
.sidebar-preload-collapsed .sidebar .sidebar-link span,
.sidebar-preload-collapsed .sidebar .sidebar-sub {
    opacity: 0;
    visibility: hidden;
    max-width: 0;
    overflow: hidden;
}
.sidebar-preload-collapsed .sidebar .sidebar-header {
    padding: 0 8px;
    margin-bottom: 0;
    height: 56px;
    box-sizing: border-box;
}
.sidebar-preload-collapsed .sidebar .sidebar-logo {
    justify-content: center;
    gap: 0;
    padding: 10px 0;
}
.sidebar-preload-collapsed .sidebar .sidebar-nav {
    padding: 16px 6px;
}
.sidebar-preload-collapsed .sidebar .sidebar-link {
    justify-content: center;
    padding: 12px 0;
    gap: 0;
}
.sidebar-preload-collapsed .sidebar .sidebar-link.active::before {
    opacity: 0;
    visibility: hidden;
}
.sidebar-preload-collapsed .sidebar ~ .page-main {
    margin-left: 64px;
}

.sidebar.collapsed {
    width: 64px;
    overflow: visible;
}

.sidebar.collapsed .sidebar-logo span,
.sidebar.collapsed .sidebar-link span,
.sidebar.collapsed .sidebar-sub {
    opacity: 0;
    visibility: hidden;
    max-width: 0;
    overflow: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, max-width 0.3s ease;
}

.sidebar.collapsed .sidebar-header {
    padding: 0 8px;
    margin-bottom: 0;
    height: 56px;
    box-sizing: border-box;
    transition: padding 0.3s ease, margin 0.3s ease;
}

.sidebar.collapsed .sidebar-logo {
    justify-content: center;
    gap: 0;
    padding: 10px 0;
    transition: gap 0.3s ease, padding 0.3s ease;
}

.sidebar.collapsed .sidebar-nav {
    padding: 16px 6px;
    transition: padding 0.3s ease;
}

.sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding: 12px 0;
    gap: 0;
    transition: padding 0.3s ease, gap 0.3s ease;
    position: relative;
}

/* 收起时悬停显示类目名称 tooltip */
.sidebar.collapsed .sidebar-link::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
}

.sidebar.collapsed .sidebar-link:hover::after {
    opacity: 1;
    visibility: visible;
}

.sidebar.collapsed .sidebar-link.active::before {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.sidebar.collapsed .sidebar-footer {
    flex-direction: column;
    gap: 8px;
    align-items: center;
    padding: 12px 8px;
    transition: padding 0.3s ease, gap 0.3s ease;
}

.sidebar-collapse-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.55);
    cursor: pointer;
    display: none !important;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.9);
    border-color: rgba(255,255,255,0.2);
}

.sidebar-collapse-btn i {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
}

/* 主内容区跟随侧边栏收起 */
.page-main {
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed ~ .page-main {
    margin-left: 64px;
}

/* 侧边栏顶部Logo */
.sidebar-header {
    padding: 0 12px;
    margin-bottom: 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    justify-content: center;
    height: 56px;
    box-sizing: border-box;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px 14px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: -0.3px;
}

.sidebar-logo i {
    font-size: 18px;
    color: #a78bfa;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-logo span {
    background: linear-gradient(135deg, #fff 0%, #c7d2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   顶部导航栏
   ============================================ */
.top-navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-header, #fff);
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.05));
    position: relative;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.top-nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.top-nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: auto;
}

.top-nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary, #1f2937);
}

.top-nav-logo i {
    font-size: 24px;
    color: var(--accent, #7c3aed);
}

.top-nav-logo span {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary, #1f2937);
}

.top-nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-nav-link {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary, #4b5563);
    text-decoration: none;
    transition: all 0.2s ease;
}

.top-nav-link:hover {
    background: var(--bg-hover, #f3f4f6);
    color: var(--text-primary, #1f2937);
}

.top-nav-link.active {
    background: var(--accent, #7c3aed);
    color: #fff;
}

.top-theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-card, #fff);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.top-theme-toggle:hover {
    background: var(--bg-hover, #f3f4f6);
    border-color: var(--border-light, #d1d5db);
}

.top-theme-toggle .icon-sun {
    color: #f59e0b;
}

.top-theme-toggle .icon-moon {
    color: #6366f1;
}

.top-collapse-btn {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    height: auto;
    border-radius: 0;
    border: none;
    background: none;
    cursor: pointer;
    display: none !important;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 4px;
    z-index: 10;
}

.top-collapse-btn:hover {
    opacity: 0.7;
}

.top-collapse-btn i {
    font-size: 22px;
    color: #4b5563;
}

/* ============================================
   主内容区
   ============================================ */
.content {
    padding: 24px 24px 60px;
}

/* ============================================
   板块标题
   ============================================ */
.section-header {
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.title-icon {
    font-size: 16px !important;
    color: #fff;
    width: 32px;
    height: 32px;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border-radius: 8px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
    transition: all 0.25s ease;
    line-height: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: center;
    vertical-align: middle;
}

.section-title:hover .title-icon {
    transform: scale(1.08) rotate(-5deg);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.title-count {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-tag);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    margin-left: 4px;
}

/* 二级分类标签区（主分类标题右侧） */
.child-cat-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
    min-width: 0;
    margin-left: 8px;
}

.child-cat-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-tag);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
    cursor: pointer;
    font-family: inherit;
}

.child-cat-tag:hover {
    color: var(--accent);
    background: var(--accent-light);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.child-cat-tag.active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}

.child-cat-tag.active .child-cat-count {
    color: #fff;
    background: rgba(255,255,255,0.25);
}

.child-cat-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 16px;
    padding: 0 5px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-light);
    border-radius: 8px;
    transition: all 0.2s;
}

/* 二级分类标题右側的“查看全部”链接 */
.subcategory-more-link {
    margin-left: auto;
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.subcategory-more-link:hover {
    text-decoration: underline;
}

.subcategory-more-link i {
    font-size: 9px;
}

/* 更多链接 */
.section-more-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--accent);
    transition: all 0.2s;
    white-space: nowrap;
}

.section-more-link:hover {
    background: var(--accent);
    color: #fff;
}

.section-more-link i {
    font-size: 11px;
    transition: transform 0.2s;
}

.section-more-link:hover i {
    transform: translateX(2px);
}

/* 分类页返回链接 */
.category-back-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
    white-space: nowrap;
}

.category-back-link:hover {
    color: var(--accent);
}

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

.empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 14px;
}

/* ========== 首页广告位 ========== */
.home-ad-banner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.home-ad-item {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    min-height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.home-ad-item img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

@media (max-width: 768px) {
    .home-ad-banner {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .home-ad-item {
        min-height: auto;
        padding: 0;
    }
    .home-ad-item img {
        width: 100%;
        max-width: 100%;
    }
}

.hot-section {
    margin-bottom: 32px;
    padding: 24px;
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--bg-section) 100%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.hot-section .section-title {
    font-size: 20px;
}

.hot-section .title-icon {
    font-size: 18px;
    color: #f59e0b;
    background: rgba(245,158,11,0.12);
}

.category-section {
    margin-bottom: 28px;
    padding: 24px;
    background: var(--bg-section);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    scroll-margin-top: 20px;
    position: relative;
}

.category-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0.6;
}

/* ============================================
   标签页筛选
   ============================================ */
.tag-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.tag-tab {
    padding: 5px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 12.5px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 450;
}

.tag-tab:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.tag-tab.active {
    background: var(--accent);
    color: var(--text-inverse);
    border-color: var(--accent);
    font-weight: 500;
}

/* ============================================
   工具卡片网格
   ============================================ */
.site-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.hot-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.hot-grid .site-card {
    padding: 16px;
    background: var(--bg-card);
}

.hot-grid .site-icon {
    width: 48px;
    height: 48px;
}

/* 二级分类小节 */
.subcategory-block {
    margin-top: 20px;
    padding: 16px 18px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.subcategory-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--border-light);
}

.subcategory-title i {
    color: var(--accent);
    font-size: 12px;
}

.subcategory-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 500;
    color: var(--accent);
    background: var(--accent-light);
    border-radius: 10px;
    margin-left: 4px;
}

.site-grid-sub {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.hot-grid .site-icon img {
    width: 36px;
    height: 36px;
}

.hot-grid .site-icon-fallback {
    width: 48px;
    height: 48px;
    font-size: 19px;
}

.hot-grid .site-name {
    font-size: 15px;
}

.hot-grid .site-desc {
    font-size: 13px;
}

.site-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    cursor: pointer;
    box-shadow: var(--shadow-card);
}

.site-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition);
}

.site-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--accent);
    z-index: 50;
}

.site-card:hover::before {
    opacity: 1;
}

/* 悬停显示完整描述 tooltip（卡片下方） */
.site-card::after {
    content: attr(data-desc);
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: #1a1a2e;
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13.5px;
    line-height: 1.6;
    white-space: normal;
    word-break: break-word;
    max-width: 260px;
    min-width: 180px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    z-index: 100;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

/* tooltip 箭头（贴在黑色框顶部，指向卡片） */
.site-card::before {
    content: '';
    position: absolute;
    top: calc(100% - 1px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 7px solid #1a1a2e;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    z-index: 101;
}

.site-card:hover::after,
.site-card:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    transition: opacity 0.2s ease 0.05s, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.site-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--bg-tag);
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition);
}

.site-card:hover .site-icon {
    transform: scale(1.05);
}

.site-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.site-icon-fallback {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-light);
    border-radius: var(--radius-sm);
}

.site-info {
    flex: 1;
    min-width: 0;
}

.site-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.2px;
}

.site-desc {
    font-size: 13.5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    margin-bottom: 6px;
}

/* 卡片底部 meta 行 */
.site-meta-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.site-meta-tags {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.site-meta-tag {
    padding: 1px 6px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: var(--radius-xs);
    font-size: 10.5px;
    font-weight: 500;
    line-height: 1.5;
}

.site-meta-views {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 3px;
    margin-left: auto;
    white-space: nowrap;
}

.site-meta-views i {
    font-size: 10px;
    color: #f59e0b;
}

/* NEW角标 */
.new-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 7px;
    background: var(--accent-gradient);
    color: var(--text-inverse);
    font-size: 10px;
    font-weight: 700;
    border-radius: var(--radius-xs);
    line-height: 1.4;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(79,70,229,0.3);
}

/* ============================================
   底部
   ============================================ */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 28px 24px;
    text-align: center;
}

.footer-inner {
    max-width: 800px;
    margin: 0 auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 12px;
}

.footer-links a {
    font-size: 13px;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-text {
    font-size: 12px;
    color: var(--text-muted);
    display: inline;
}

.footer-icp {
    margin-top: 0;
    display: inline;
    margin-left: 8px;
}

.footer-icp a {
    font-size: 12px;
    color: var(--text-muted);
}

.footer-icp a:hover {
    color: var(--text-muted);
}

/* ============================================
   右下角悬浮按钮组
   ============================================ */
.float-btn-group {
    position: fixed;
    bottom: 28px;
    right: 28px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 500;
}

.float-theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    transition: all var(--transition);
}

.float-theme-toggle:hover {
    background: var(--accent);
    color: var(--text-inverse);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.3);
}

.float-theme-toggle .icon-moon {
    display: none;
}

[data-theme="dark"] .float-theme-toggle .icon-sun {
    display: none;
}

[data-theme="dark"] .float-theme-toggle .icon-moon {
    display: block;
}

/* 悬浮侧边栏切换按钮 */
.float-sidebar-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    transition: all var(--transition);
}

.float-sidebar-toggle:hover {
    background: var(--accent);
    color: var(--text-inverse);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.3);
}

.float-sidebar-toggle i {
    font-size: 16px;
}

/* ============================================
   回到顶部
   ============================================ */
.back-to-top {
    position: static;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: var(--text-inverse);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(79,70,229,0.35);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition);
    z-index: 500;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79,70,229,0.4);
}

.back-to-top i {
    font-size: 16px;
}

/* ============================================
   工具详情页
   ============================================ */
.detail-content {
    padding-top: 20px;
}

/* 面包屑 */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-weight: 450;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.breadcrumb a {
    color: var(--text-secondary);
    transition: color var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.breadcrumb a:hover {
    color: var(--accent);
}

.breadcrumb-sep {
    font-size: 8px;
    color: var(--border-color);
}

.breadcrumb span {
    color: var(--text-primary);
    font-weight: 500;
}

/* ========== 详情页（仿 ai-kit.cn） ========== */

/* 详情页主内容区 */
.detail-page-content {
    flex: 1;
    padding: 24px 32px 40px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* 面包屑 */
.detail-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.detail-breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.detail-breadcrumb a:hover {
    color: var(--accent);
}

.detail-breadcrumb i {
    font-size: 10px;
    color: var(--border-color);
}

.detail-breadcrumb span {
    color: var(--text-primary);
    font-weight: 500;
}

/* 详情头部卡片 */
.detail-header-section {
    margin-bottom: 24px;
}

.detail-header-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 36px 40px;
    display: flex;
    gap: 36px;
    align-items: flex-start;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* 左列 */
.detail-header-left {
    width: 280px;
    flex-shrink: 0;
}

.detail-screenshot-wrap {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.detail-screenshot {
    width: 100%;
    height: 185px;
    object-fit: cover;
    display: block;
}

.detail-icon-box {
    width: 100%;
    height: 185px;
    border-radius: 10px;
    background: var(--bg-tag);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.detail-icon-box img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.detail-icon-letter {
    font-size: 56px;
    font-weight: 700;
    color: var(--accent);
    background: linear-gradient(135deg, var(--accent-light), var(--bg-tag));
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

/* 右列 */
.detail-header-right {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.tag-red {
    display: inline-flex;
    align-items: center;
    padding: 4px 14px;
    background: #f1404b;
    color: #fff;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}

.tag-red:hover {
    opacity: 0.85;
}

.detail-h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.detail-desc-text {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.detail-tags-label {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
}

.detail-go-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: #1a1a2e;
    color: #fff;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    align-self: flex-start;
    margin-top: 4px;
}

.detail-go-btn:hover {
    background: #2d2d44;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* 广告列 */
.detail-header-ad {
    width: 250px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
}

/* 横幅 */
.detail-banner-wrap {
    margin-bottom: 24px;
    border-radius: 12px;
    overflow: hidden;
}

.detail-banner-wrap > * {
    max-width: 100%;
    display: block;
}

/* 快照图片区域 */
.detail-screenshot-section {
    margin: 24px 0 32px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    background: var(--bg-card);
}

.detail-screenshot-full {
    width: 100%;
    max-height: 520px;
    object-fit: cover;
    object-position: top center;
    display: block;
}

/* 统计徽章 + 点赞栏（截图下方） */
.detail-stats-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 0 4px;
}

.detail-stats-bar .stat-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--bg-tag);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.detail-stats-bar .stat-badge i {
    font-size: 14px;
    color: var(--text-muted);
}

.detail-stats-bar .stat-badge span {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 14px;
}

/* 点赞徽章已赞状态 */
.stat-like.liked {
    background: #f1404b;
    border-color: #f1404b;
}

.stat-like.liked i,
.stat-like.liked span {
    color: #fff;
}

.stat-like.liked i {
    animation: likeAnim 0.4s ease;
}

@keyframes likeAnim {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* 详细介绍内容区 */
.detail-rich-content {
    margin: 32px 0;
}

.detail-rich-content h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 36px 0 16px 0;
    padding-left: 16px;
    border-left: 4px solid #f1404b;
    line-height: 1.4;
}

.detail-rich-content h2:first-child {
    margin-top: 0;
}

.detail-rich-content h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 24px 0 12px 0;
}

.detail-rich-content p {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin: 0 0 16px 0;
}

.detail-rich-content ul,
.detail-rich-content ol {
    margin: 0 0 16px 0;
    padding-left: 24px;
}

.detail-rich-content li {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.detail-rich-content li strong {
    color: var(--text-primary);
    font-weight: 600;
}

.detail-rich-content img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 16px 0;
}

.detail-rich-content blockquote {
    margin: 16px 0;
    padding: 12px 20px;
    background: var(--bg-tag);
    border-left: 4px solid var(--accent);
    border-radius: 0 8px 8px 0;
}

.detail-rich-content code {
    background: var(--bg-tag);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.detail-rich-content pre {
    background: #1a1a2e;
    color: #e0e0e0;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0;
}

.detail-rich-content pre code {
    background: none;
    padding: 0;
}

/* 相关介绍信息区域 */
.detail-related-intro {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--border-color);
}

.detail-related-intro h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 32px 0 16px 0;
    padding-left: 16px;
    border-left: 4px solid #f1404b;
    line-height: 1.4;
}

.detail-related-intro h2:first-child {
    margin-top: 0;
}

.detail-related-intro h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 24px 0 12px 0;
}

.detail-related-intro p {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin: 0 0 16px 0;
}

.detail-related-intro ul,
.detail-related-intro ol {
    margin: 0 0 16px 0;
    padding-left: 24px;
}

.detail-related-intro li {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.detail-related-intro li strong {
    color: var(--text-primary);
    font-weight: 600;
}

.detail-related-intro img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 16px 0;
}

/* 相关导航 */
.related-nav-section {
    margin-top: 40px;
    margin-bottom: 24px;
}

.related-nav-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 20px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.related-nav-title i {
    color: var(--accent);
}

.related-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.related-nav-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s;
}

.related-nav-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transform: translateY(-2px);
}

.related-nav-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: var(--bg-tag);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
}

.related-nav-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.related-nav-letter {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-light);
}

.related-nav-info {
    flex: 1;
    min-width: 0;
}

.related-nav-info h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.related-nav-info p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
}

/* Toast 通知 */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    opacity: 0;
    transform: translateX(40px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
}

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

.toast i {
    color: #22c55e;
    font-size: 16px;
    flex-shrink: 0;
}

/* 暗色模式 - Toast */
[data-theme="dark"] .toast {
    background: #1e293b;
    border-color: rgba(255,255,255,0.1);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

[data-theme="dark"] .toast i {
    color: #4ade80;
}

/* 响应式：窄屏堆叠 */
@media (max-width: 900px) {
    .detail-card {
        flex-direction: column;
    }
    .detail-card-left {
        width: 100%;
        flex-direction: row;
        align-items: flex-start;
        gap: 16px;
    }
    .detail-icon-lg {
        width: 80px;
        height: 80px;
    }
    .detail-icon-lg img {
        width: 48px;
        height: 48px;
    }
    .detail-icon-fallback-lg {
        width: 80px;
        height: 80px;
        font-size: 32px;
    }
    .detail-actions-vertical {
        flex: 1;
        flex-direction: row;
        align-items: center;
    }
    .detail-actions-vertical .btn-visit {
        flex: 1;
    }
    .detail-actions-vertical .btn-copy {
        width: auto;
        padding: 0 16px;
    }
    .detail-card-right {
        width: 100%;
    }
    .detail-card-right .ad-placeholder {
        min-height: 120px;
    }
    .detail-meta-top {
        gap: 8px;
    }
}

/* ============================================
   暗色模式 - 广告区域样式增强
   ============================================ */

/* 广告占位区域 */
[data-theme="dark"] .detail-card-right .ad-placeholder {
    background: rgba(255,255,255,0.03);
    border: 2px dashed rgba(255,255,255,0.12);
}

[data-theme="dark"] .detail-card-right .ad-placeholder i {
    color: var(--text-secondary);
    opacity: 0.5;
}

[data-theme="dark"] .detail-card-right .ad-placeholder p {
    color: rgba(255,255,255,0.4);
}

[data-theme="dark"] .detail-card-right .ad-placeholder span {
    color: rgba(255,255,255,0.2);
}

/* 实际广告容器 */
[data-theme="dark"] .detail-card-right .ad-content {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-md);
    padding: 8px;
}

/* 横幅广告区域 */
[data-theme="dark"] .detail-banner-section {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.1);
}

/* ============================================
   响应式适配
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
    .page-main {
        margin-left: 220px;
    }
    .sidebar.collapsed {
        width: 64px;
    }
    .sidebar.collapsed ~ .page-main {
        margin-left: 64px;
    }
}

@media (max-width: 768px) {
    /* ===== 侧边栏：抽屉模式 ===== */
    .sidebar {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        width: 220px;
        max-width: 70vw;
        height: 100vh;
        height: 100dvh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }
    /* 防止页面加载时侧边栏闪烁 */
    .sidebar-preload-collapsed .sidebar {
        transform: translateX(-100%) !important;
        width: 220px;
        max-width: 70vw;
    }
    .sidebar-preload-collapsed .sidebar ~ .page-main {
        margin-left: 0 !important;
    }
    .sidebar-preload-collapsed .sidebar .sidebar-logo span,
    .sidebar-preload-collapsed .sidebar .sidebar-link span,
    .sidebar-preload-collapsed .sidebar .sidebar-sub {
        opacity: 1;
        visibility: visible;
        max-width: 200px;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 32px rgba(0,0,0,0.4);
    }
    /* 移动端打开侧边栏时显示文字 */
    .sidebar-preload-collapsed .sidebar.open .sidebar-logo span,
    .sidebar-preload-collapsed .sidebar.open .sidebar-link span,
    .sidebar-preload-collapsed .sidebar.open .sidebar-sub,
    .sidebar.open .sidebar-logo span,
    .sidebar.open .sidebar-link span,
    .sidebar.open .sidebar-sub {
        opacity: 1 !important;
        visibility: visible !important;
        max-width: 200px !important;
    }
    .sidebar.open .sidebar-arrow,
    .sidebar.open .sidebar-children {
        display: block !important;
    }
    .page-main {
        margin-left: 0;
    }

    /* ===== 遮罩层 ===== */
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        -webkit-tap-highlight-color: transparent;
    }
    .sidebar-backdrop.show {
        opacity: 1;
        pointer-events: auto;
    }

    /* ===== 移动端侧边栏Logo尺寸优化 ===== */
    .sidebar-logo {
        gap: 10px;
        padding: 10px 14px;
    }
    .sidebar-logo i {
        font-size: 28px;
    }
    .sidebar-logo span {
        font-size: 20px;
        font-weight: 600;
    }
    .sidebar-header {
        padding: 12px 14px 16px;
    }

    /* ===== 汉堡菜单按钮（已移至右下角悬浮按钮组） ===== */
    .hamburger-btn {
        display: none !important;
    }

    /* 移动端隐藏旧的主题切换按钮（使用悬浮按钮组代替） */
    .theme-toggle-mobile {
        display: none !important;
    }

    /* 搜索区域 */
    .search-section {
        padding: 12px 12px 8px;
        padding-top: 52px;
        text-align: center;
    }
    .hero-brand {
        margin-bottom: 16px;
    }
    .hero-title {
        font-size: 24px;
        margin-bottom: 4px;
    }
    .hero-subtitle {
        font-size: 14px;
        margin-bottom: 10px;
    }
    .hero-stats {
        font-size: 12px;
        gap: 8px;
    }
    .hero-stat i {
        font-size: 11px;
    }
    .search-input-wrap {
        padding: 0 4px 0 12px;
        border-radius: var(--radius-lg);
    }
    .search-input {
        font-size: 14px;
        padding: 11px 8px;
    }
    .search-btn {
        padding: 8px 12px;
        min-width: 40px;
        min-height: 36px;
        font-size: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .search-btn::before {
        content: '\f002';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        font-size: 14px;
    }
    .search-engines {
        gap: 4px;
        margin-bottom: 10px;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }
    .search-engines::-webkit-scrollbar {
        display: none;
    }
    .engine-btn {
        font-size: 11px;
        padding: 4px 10px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* 主内容 */
    .content {
        padding: 12px 8px 36px;
    }
    .hot-section {
        padding: 16px 14px;
        margin-bottom: 20px;
        border-radius: var(--radius-md);
    }
    .hot-section .section-title {
        font-size: 17px;
    }
    .hot-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
    }
    .hot-grid .site-card {
        padding: 12px;
    }
    .hot-grid .site-icon {
        width: 40px;
        height: 40px;
    }
    .hot-grid .site-icon img {
        width: 28px;
        height: 28px;
    }
    .hot-grid .site-icon-fallback {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    .hot-grid .site-name {
        font-size: 14.5px;
    }
    .hot-grid .site-desc {
        font-size: 12.5px;
    }
    .category-section {
        padding: 14px 12px;
        margin-bottom: 12px;
        border-radius: var(--radius-md);
    }
    .category-section::before {
        height: 2px;
    }
    .section-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    .section-title {
        font-size: 17px;
    }
    .title-icon {
        width: 24px;
        height: 24px;
        font-size: 14px;
    }
    .section-more-link {
        font-size: 12px;
        padding: 3px 10px;
    }

    /* 标签筛选可滚动 */
    .tag-tabs {
        gap: 4px;
        margin-bottom: 12px;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }
    .tag-tabs::-webkit-scrollbar {
        display: none;
    }
    .tag-tab {
        font-size: 11.5px;
        padding: 4px 12px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* 工具卡片 */
    .site-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 8px;
    }
    .hot-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    .site-card {
        padding: 10px 12px;
        gap: 10px;
    }
    .site-icon {
        width: 38px;
        height: 38px;
    }
    .site-icon img {
        width: 26px;
        height: 26px;
    }
    .site-icon-fallback {
        width: 38px;
        height: 38px;
        font-size: 15px;
    }
    .site-name {
        font-size: 14.5px;
    }
    .site-desc {
        font-size: 12.5px;
    }
    .site-meta-tag {
        font-size: 10px;
        padding: 1px 5px;
    }
    .new-badge {
        top: 6px;
        right: 6px;
        font-size: 9px;
        padding: 1px 5px;
    }

    /* 详情页 */
    .detail-content {
        padding: 12px 8px 36px;
    }
    .breadcrumb {
        font-size: 12px;
        margin-bottom: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        white-space: nowrap;
    }
    .breadcrumb::-webkit-scrollbar {
        display: none;
    }
    .detail-card {
        flex-direction: column;
        padding: 16px;
        gap: 16px;
        margin-bottom: 16px;
        border-radius: var(--radius-md);
    }
    .detail-card-left {
        width: 100%;
        flex-direction: row;
        align-items: flex-start;
        gap: 12px;
    }
    .detail-icon-lg {
        width: 64px;
        height: 64px;
        border-radius: var(--radius-sm);
    }
    .detail-icon-lg img {
        width: 40px;
        height: 40px;
    }
    .detail-icon-fallback-lg {
        width: 64px;
        height: 64px;
        font-size: 24px;
    }
    .detail-stats-vertical {
        flex: 1;
        gap: 4px;
    }
    .stat-block {
        font-size: 12px;
        padding: 5px 8px;
        justify-content: flex-start;
    }
    .detail-card-right {
        width: 100%;
    }
    .detail-card-right .ad-placeholder {
        min-height: 100px;
        padding: 16px 12px;
        gap: 6px;
    }
    .detail-card-right .ad-placeholder i {
        font-size: 24px;
    }
    .detail-card-right .ad-placeholder p {
        font-size: 13px;
    }
    .detail-card-center .detail-title {
        font-size: 20px;
    }
    .detail-card-center .detail-desc p {
        font-size: 14px;
        line-height: 1.6;
    }
    .detail-card-center .detail-tags {
        gap: 4px;
        margin-bottom: 10px;
    }
    .detail-card-center .detail-tag {
        font-size: 12px;
        padding: 2px 8px;
    }
    .detail-card-center .detail-actions {
        gap: 6px;
    }
    .detail-card-center .btn-visit {
        padding: 10px 20px;
        font-size: 14px;
    }
    .detail-card-center .btn-copy {
        width: 36px;
        height: 36px;
    }
    .detail-banner-section {
        padding: 12px;
        margin-bottom: 16px;
        border-radius: var(--radius-md);
    }

    /* Toast */
    .toast-container {
        top: 12px;
        right: 0;
        left: 0;
        align-items: center;
        padding: 0 12px;
    }
    .toast {
        transform: translateY(-20px);
        font-size: 13px;
        padding: 10px 16px;
    }
    .toast.show {
        transform: translateY(0);
    }

    /* 页脚 */
    .footer {
        padding: 20px 16px;
    }
    .footer-links {
        flex-wrap: wrap;
        gap: 12px;
    }
    .footer-links a {
        font-size: 12px;
    }
    .footer-text {
        font-size: 11px;
    }
    .footer-icp a {
        font-size: 11px;
    }

    /* 分类更多页 */
    .category-back-link {
        font-size: 12px;
    }
    .empty-state {
        padding: 36px 16px;
    }
    .empty-icon {
        font-size: 36px;
    }
    .empty-state p {
        font-size: 13px;
    }

    /* 回到顶部 */
    .back-to-top {
        bottom: 16px;
        right: 12px;
        width: 36px;
        height: 36px;
    }
    .back-to-top i {
        font-size: 14px;
    }
}

/* --- 小屏手机（≤480px）：进一步紧凑 --- */
@media (max-width: 480px) {
    .search-section {
        padding: 10px 8px 6px;
        padding-top: 50px;
    }
    .hero-title {
        font-size: 19px;
    }
    .hero-subtitle {
        font-size: 12px;
        margin-bottom: 8px;
    }
    .hero-stats {
        font-size: 11px;
    }
    .hero-brand {
        margin-bottom: 12px;
    }
    .search-input {
        font-size: 13px;
        padding: 10px 6px;
    }
    .content {
        padding: 10px 4px 28px;
    }
    .hot-section {
        padding: 12px 10px;
        margin-bottom: 14px;
    }
    .hot-grid {
        grid-template-columns: 1fr;
    }
    .category-section {
        padding: 12px 10px;
        margin-bottom: 10px;
    }
    .section-title {
        font-size: 15px;
    }
    .site-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .site-card {
        padding: 10px;
        gap: 8px;
    }
    .site-icon {
        width: 36px;
        height: 36px;
    }
    .site-icon img {
        width: 24px;
        height: 24px;
    }
    .site-icon-fallback {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    .site-name {
        font-size: 12.5px;
    }
    .site-desc {
        font-size: 11px;
    }
    .detail-card-center .detail-title {
        font-size: 17px;
    }
    .detail-card-center .btn-visit {
        padding: 10px 20px;
        font-size: 13px;
    }
    .breadcrumb {
        font-size: 11px;
        margin-bottom: 10px;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .breadcrumb::-webkit-scrollbar {
        display: none;
    }

    /* 小屏详情页 */
    .detail-header-card {
        padding: 12px;
        gap: 12px;
    }
    .detail-screenshot {
        height: 140px;
    }
    .detail-h1 {
        font-size: 20px;
    }
    .detail-desc-text {
        font-size: 13px;
    }
    .detail-tags-label {
        font-size: 12px;
    }
    .detail-go-btn {
        padding: 10px 20px;
        font-size: 13px;
    }
    .stat-badge {
        padding: 4px 8px;
        font-size: 11px;
    }
    .stat-badge i {
        font-size: 11px;
    }
    .stat-badge span {
        font-size: 12px;
    }
    .detail-like-btn {
        padding: 4px 10px;
        font-size: 11px;
    }
    .detail-rich-content h2 {
        font-size: 16px;
    }
    .detail-rich-content p,
    .detail-rich-content li {
        font-size: 13px;
    }
    .related-nav-title {
        font-size: 15px;
    }
}

/* 加载更多按钮 */
.load-more-wrap {
    text-align: center;
    margin: 24px 0 8px;
}

.load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition);
}

.load-more-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.load-more-btn .fa-spinner {
    animation: fa-spin 1s linear infinite;
}

/* ============================================
   暗色模式专属优化
   ============================================ */
[data-theme="dark"] {
    color-scheme: dark;
}

/* 暗色模式下的身体背景渐变 */
[data-theme="dark"] body {
    background: linear-gradient(180deg, #0a0e1a 0%, #0f1421 100%);
    background-attachment: fixed;
}

/* 暗色模式 - Header */
[data-theme="dark"] .header {
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: rgba(15,20,33,0.85);
    backdrop-filter: blur(20px) saturate(150%);
}

/* 暗色模式 - 搜索区域 */
[data-theme="dark"] .search-section {
    background: linear-gradient(135deg, #141a28 0%, #1a1f35 50%, #16142a 100%);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

[data-theme="dark"] .search-section::before {
    background: radial-gradient(ellipse, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
}

[data-theme="dark"] .search-section::after {
    background: radial-gradient(ellipse, rgba(139, 92, 246, 0.06) 0%, transparent 70%);
}

[data-theme="dark"] .search-input-wrap {
    background: rgba(30, 41, 59, 0.8);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .search-input-wrap:focus-within {
    background: rgba(30, 41, 59, 0.95);
    box-shadow: 0 4px 24px rgba(99, 102, 241, 0.2), 0 0 0 4px rgba(99, 102, 241, 0.15);
}

[data-theme="dark"] .hero-title {
    background: linear-gradient(135deg, #a78bfa, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="dark"] .hero-subtitle {
    color: #94a3b8;
}

[data-theme="dark"] .hero-stats {
    color: #64748b;
}

[data-theme="dark"] .hero-stat {
    color: #94a3b8;
}

[data-theme="dark"] .hero-stat strong {
    color: #e2e8f0;
}

[data-theme="dark"] .hero-stat-sep {
    color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .search-input-wrap {
    background: #1a2030;
    border-color: rgba(255,255,255,0.08);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.04);
}

[data-theme="dark"] .search-input-wrap:focus-within {
    background: #232b3d;
    border-color: rgba(167,139,250,0.4);
    box-shadow: 0 0 0 3px rgba(167,139,250,0.15), 0 4px 20px rgba(0,0,0,0.4);
}

[data-theme="dark"] .engine-btn,
[data-theme="dark"] .tag-tab {
    background: #1a2030;
    border-color: rgba(255,255,255,0.08);
}

[data-theme="dark"] .engine-btn:hover,
[data-theme="dark"] .tag-tab:hover {
    background: #232b3d;
    border-color: rgba(167,139,250,0.4);
    color: #a78bfa;
}

/* 暗色模式 - 热门推荐 */
[data-theme="dark"] .hot-section {
    background: linear-gradient(135deg, rgba(167,139,250,0.08) 0%, #141a28 100%);
    border: 1px solid rgba(255,255,255,0.06);
}

/* 暗色模式 - 分类区块 */
[data-theme="dark"] .category-section {
    background: linear-gradient(180deg, #141a28 0%, #1a2030 100%);
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.03);
}

[data-theme="dark"] .section-title {
    color: #f1f5f9;
}

[data-theme="dark"] .title-icon {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: #fff;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.5);
}

[data-theme="dark"] .title-count {
    background: rgba(167,139,250,0.15);
    color: #c4b5fd;
}

/* 暗色模式 - 工具卡片 */
[data-theme="dark"] .site-card {
    background: #1a2030;
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.04);
}

[data-theme="dark"] .site-card:hover {
    background: #232b3d;
    border-color: rgba(167,139,250,0.3);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 0 1px rgba(167,139,250,0.15), inset 0 1px 0 rgba(255,255,255,0.06);
    transform: translateY(-2px);
}

[data-theme="dark"] .site-icon {
    background: #232b3d;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

[data-theme="dark"] .site-icon-fallback {
    color: #c4b5fd;
}

[data-theme="dark"] .site-name {
    color: #f1f5f9;
}

[data-theme="dark"] .site-desc {
    color: #94a3b8;
}

[data-theme="dark"] .site-meta-tag {
    background: rgba(167,139,250,0.15);
    color: #c4b5fd;
}

[data-theme="dark"] .site-meta-views {
    color: #64748b;
}

/* 暗色模式 - NEW 徽章 */
[data-theme="dark"] .new-badge {
    background: linear-gradient(135deg, #ef4444, #f59e0b);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239,68,68,0.4);
}

/* 暗色模式 - 加载更多 */
[data-theme="dark"] .load-more-btn {
    background: #1a2030;
    border-color: rgba(255,255,255,0.08);
    color: #94a3b8;
}

[data-theme="dark"] .load-more-btn:hover {
    background: #232b3d;
    border-color: rgba(167,139,250,0.4);
    color: #c4b5fd;
}

/* 暗色模式 - 详情页 */
[data-theme="dark"] .detail-card {
    background: #1a2030;
    border-color: rgba(255,255,255,0.06);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.04);
}

[data-theme="dark"] .stat-block {
    background: #0f1421;
    border-color: rgba(255,255,255,0.06);
    color: #94a3b8;
}

[data-theme="dark"] .stat-block-rank i {
    color: #fbbf24;
}

[data-theme="dark"] .detail-card-center .detail-desc p {
    color: #94a3b8;
}

[data-theme="dark"] .detail-tag {
    background: #1a2030;
    border-color: rgba(255,255,255,0.06);
    color: #94a3b8;
}

[data-theme="dark"] .detail-tag:hover {
    background: #232b3d;
    border-color: rgba(167,139,250,0.3);
    color: #c4b5fd;
}

[data-theme="dark"] .detail-icon-lg,
[data-theme="dark"] .detail-icon-fallback-lg {
    background: #232b3d;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
}

[data-theme="dark"] .detail-icon-fallback-lg {
    color: #c4b5fd;
}

/* ========== 前端分页 ========== */
.category-section .pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    margin-top: 20px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}

.pagination-info strong {
    color: var(--text-primary);
    font-weight: 600;
}

.pagination-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-link {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-weight: 500;
}

.page-link:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.page-link.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(79,70,229,0.25);
}

.page-nav {
    min-width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.page-nav:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.page-nav.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.page-ellipsis {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-muted);
    user-select: none;
}

/* 暗色分页 */
[data-theme="dark"] .page-link {
    border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .page-link:hover {
    background: rgba(108,99,255,0.12);
}

[data-theme="dark"] .page-nav {
    border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .page-nav:hover {
    background: rgba(108,99,255,0.12);
}

[data-theme="dark"] .btn-copy,
[data-theme="dark"] .btn-share {
    background: #1a2030;
    border-color: rgba(255,255,255,0.08);
    color: #94a3b8;
}

[data-theme="dark"] .btn-copy:hover,
[data-theme="dark"] .btn-share:hover {
    background: #232b3d;
    border-color: rgba(167,139,250,0.3);
    color: #c4b5fd;
}

/* 暗色模式 - Footer */
[data-theme="dark"] .footer {
    background: #0f1421;
    border-top: 1px solid rgba(255,255,255,0.06);
}

[data-theme="dark"] .footer-text,
[data-theme="dark"] .footer-icp {
    color: #64748b;
}

/* 暗色模式 - 主题切换按钮 */
[data-theme="dark"] .theme-toggle {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    color: #94a3b8;
}

[data-theme="dark"] .theme-toggle:hover {
    background: rgba(255,255,255,0.08);
    color: #f1f5f9;
}

/* 暗色模式 - 汉堡按钮 */
[data-theme="dark"] .hamburger-btn {
    background: #1a2030;
    border-color: rgba(255,255,255,0.08);
    color: #94a3b8;
}

[data-theme="dark"] .hamburger-btn:hover {
    background: #232b3d;
    border-color: rgba(167,139,250,0.3);
    color: #f1f5f9;
}

/* 暗色模式 - 侧边栏遮罩 */
[data-theme="dark"] .sidebar-backdrop {
    background: rgba(0,0,0,0.7);
}

/* 移动端 body 滚动锁定 */
body.sidebar-open {
    overflow: hidden;
}

/* 移动端隐藏收起按钮（侧边栏变为抽屉模式） */
@media (max-width: 768px) {
    .sidebar-collapse-btn {
        display: none !important;
    }
    .sidebar.collapsed {
        transform: translateX(-100%);
        width: 220px;
        max-width: 70vw;
    }
    .sidebar.collapsed.open {
        transform: translateX(0);
    }
    .sidebar.collapsed .sidebar-logo span,
    .sidebar.collapsed .sidebar-link span,
    .sidebar.collapsed .sidebar-sub {
        display: initial;
        opacity: 1;
        visibility: visible;
        max-width: 200px;
    }
    .sidebar.collapsed .sidebar-arrow,
    .sidebar.collapsed .sidebar-children {
        display: block;
    }
    /* 移动端二级导航优化 */
    .sidebar-children {
        margin-left: 8px;
        margin-top: 4px;
        margin-bottom: 4px;
        border-left: 2px solid rgba(255,255,255,0.15);
    }
    .sidebar-child {
        padding: 10px 14px 10px 16px !important;
        font-size: 13px !important;
        color: rgba(255,255,255,0.65) !important;
        border-radius: 0 6px 6px 0 !important;
        border-left: 2px solid transparent;
        margin-left: -2px;
        transition: all 0.2s ease;
    }
    .sidebar-child i {
        font-size: 5px !important;
        color: rgba(255,255,255,0.4) !important;
    }
    .sidebar-child:hover {
        background: rgba(255,255,255,0.08) !important;
        color: #fff !important;
        border-left-color: rgba(255,255,255,0.5);
        padding-left: 20px !important;
    }
    .sidebar-child.active {
        background: rgba(124, 58, 237, 0.2) !important;
        color: #fff !important;
        border-left-color: #a78bfa;
        font-weight: 500 !important;
    }
    .sidebar.collapsed .sidebar-header {
        padding: 0 12px 16px;
    }
    .sidebar.collapsed .sidebar-logo {
        justify-content: flex-start;
        gap: 10px;
        padding: 8px 14px;
    }
    .sidebar.collapsed .sidebar-nav {
        padding: 16px 12px;
    }
    .sidebar.collapsed .sidebar-link {
        justify-content: flex-start;
        padding: 12px 16px;
        gap: 12px;
    }
    .sidebar.collapsed .sidebar-link.active::before {
        display: block;
    }
    .sidebar.collapsed .sidebar-footer {
        flex-direction: row;
        gap: 0;
        justify-content: center;
        padding: 16px 20px;
    }
    .sidebar.collapsed ~ .page-main {
        margin-left: 0 !important;
    }

    /* ===== 详情页头部卡片移动端 ===== */
    .detail-header-card {
        flex-direction: column;
        padding: 16px;
        gap: 16px;
    }
    .detail-header-left {
        width: 100%;
    }
    .detail-screenshot-wrap {
        border-radius: 8px;
    }
    .detail-screenshot {
        height: 160px;
    }
    .detail-stats-bar {
        justify-content: flex-start;
        gap: 8px;
    }
    .stat-badge {
        padding: 5px 10px;
        font-size: 12px;
    }
    .stat-badge i {
        font-size: 12px;
    }
    .stat-badge span {
        font-size: 13px;
    }
    .detail-like-btn {
        padding: 5px 12px;
        font-size: 12px;
    }
    .detail-header-right {
        width: 100%;
    }
    .detail-h1 {
        font-size: 22px;
    }
    .detail-desc-text {
        font-size: 14px;
    }
    .detail-tags-label {
        font-size: 13px;
    }
    .detail-go-btn {
        padding: 10px 24px;
        font-size: 14px;
    }
    .detail-header-ad {
        width: 100%;
        min-height: 100px;
    }
    .detail-banner-wrap {
        margin: 16px 0;
    }

    /* ===== 详情页内容区移动端 ===== */
    .detail-page-content {
        padding: 12px 8px 36px;
    }
    .detail-breadcrumb {
        font-size: 12px;
        padding: 0 4px;
    }
    .detail-rich-content {
        margin: 20px 0;
        padding: 0 4px;
    }
    .detail-rich-content h2 {
        font-size: 18px;
    }
    .detail-rich-content p,
    .detail-rich-content li {
        font-size: 14px;
    }
    .detail-related-intro {
        margin-top: 24px;
    }

    /* ===== 相关导航移动端 ===== */
    .related-nav-section {
        padding: 16px 12px;
    }
    .related-nav-title {
        font-size: 17px;
    }
    .related-nav-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .related-nav-card {
        padding: 12px;
    }
    .related-nav-icon {
        width: 40px;
        height: 40px;
    }
    .related-nav-icon img {
        width: 28px;
        height: 28px;
    }
    .related-nav-letter {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    .related-nav-info h3 {
        font-size: 14px;
    }
    .related-nav-info p {
        font-size: 12px;
    }
}

/* 暗色模式 - 回到顶部 */
[data-theme="dark"] .back-to-top {
    background: #1a2030;
    border: 1px solid rgba(255,255,255,0.08);
    color: #94a3b8;
}

[data-theme="dark"] .back-to-top:hover {
    background: #232b3d;
    color: #a78bfa;
    border-color: rgba(167,139,250,0.3);
}

/* 暗色模式 - 滚动条 */
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #0f1421;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}

/* ========== 搜索页面 ========== */
.search-home {
    max-width: 800px;
    margin: 0 auto;
}

.search-home-hero {
    text-align: center;
    padding: 32px 0 24px;
}

.search-home-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.search-home-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin: 0;
}

/* 热门搜索 */
.search-hot-words {
    margin-bottom: 32px;
}

.search-hot-title, .search-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-hot-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.search-hot-tag {
    display: inline-block;
    padding: 6px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
}

.search-hot-tag:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

/* 热门分类网格 */
.search-cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.search-cat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
}

.search-cat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.search-cat-card i {
    font-size: 24px;
    color: var(--accent);
}

.search-cat-name {
    font-size: 14px;
    font-weight: 600;
}

.search-cat-count {
    font-size: 12px;
    color: var(--text-muted);
}

/* 搜索结果页 */
.search-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.search-results-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
}

.search-results-title .highlight {
    color: var(--accent);
    font-weight: 600;
}

.search-results-title strong {
    color: var(--accent);
    font-size: 18px;
}

/* 排序按钮 */
.search-sort {
    display: flex;
    gap: 4px;
}

.search-sort-btn {
    padding: 5px 14px;
    border-radius: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.search-sort-btn.active, .search-sort-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* 分类筛选栏 */
.search-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.search-filter-tag {
    padding: 5px 14px;
    border-radius: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    background: var(--bg-section);
    border: 1px solid transparent;
    transition: all 0.2s;
}

.search-filter-tag.active, .search-filter-tag:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

/* 搜索结果卡片分类标签 */
.site-cat-tag {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 8px;
    background: var(--bg-section);
    border-radius: 10px;
    font-size: 11px;
    color: var(--text-muted);
}

/* 分页 */
.search-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 32px 0;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.page-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.page-info {
    font-size: 13px;
    color: var(--text-muted);
}

/* 无结果 */
.search-no-results {
    text-align: center;
    padding: 48px 0;
    color: var(--text-muted);
}

.search-no-results i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.search-no-results p {
    margin: 12px 0 20px;
    font-size: 15px;
}

.search-no-results .search-hot-tags {
    justify-content: center;
}

/* 搜索页响应式 */
@media (max-width: 768px) {
    .search-home-title { font-size: 22px; }
    .search-cat-grid { grid-template-columns: repeat(3, 1fr); }
    .search-results-header { flex-direction: column; align-items: flex-start; }
    .search-pagination { flex-wrap: wrap; }
}

/* ============================================
   移动端全面优化（主页 + 详情页）
   ============================================ */
@media (max-width: 768px) {
    /* ===== 顶部导航栏移动端 ===== */
    .top-navbar {
        padding: 0 12px;
        height: 50px;
    }
    .top-nav-container {
        padding: 0;
        height: 50px;
    }
    .top-collapse-btn {
        left: 8px;
    }
    .top-collapse-btn i {
        font-size: 18px;
    }
    .top-nav-links {
        gap: 4px;
    }
    .top-nav-link {
        padding: 6px 12px;
        font-size: 13px;
    }

    /* ===== 悬浮按钮组移动端 ===== */
    .float-btn-group {
        bottom: 16px;
        right: 12px;
        gap: 10px;
    }
    .float-sidebar-toggle,
    .float-theme-toggle,
    .back-to-top {
        width: 36px;
        height: 36px;
    }
    .float-sidebar-toggle i,
    .float-theme-toggle i,
    .back-to-top i {
        font-size: 14px;
    }

    /* ===== 相关导航网格移动端（2列） ===== */
    .related-nav-section {
        padding: 16px 0;
        margin-top: 24px;
    }
    .related-nav-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .related-nav-card {
        padding: 12px;
        gap: 10px;
        overflow: hidden;
    }
    .related-nav-icon {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }
    .related-nav-icon img {
        width: 28px;
        height: 28px;
    }
    .related-nav-letter {
        width: 40px;
        height: 40px;
        font-size: 15px;
    }
    .related-nav-info {
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }
    .related-nav-info h3 {
        font-size: 14px;
        line-height: 1.3;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .related-nav-info p {
        font-size: 12px;
        line-height: 1.4;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        white-space: normal;
    }

    /* ===== 主页分类区块移动端优化 ===== */
    .category-section {
        padding: 14px 10px;
        margin-bottom: 12px;
    }
    .section-header {
        padding: 0 2px;
    }
    .section-title {
        font-size: 16px;
    }
    .title-icon {
        width: 22px;
        height: 22px;
        font-size: 13px;
    }
    .section-more-link {
        font-size: 12px;
        padding: 4px 10px;
    }

    /* ===== 工具卡片移动端优化 ===== */
    .site-card {
        padding: 10px 12px;
        gap: 10px;
    }
    .site-icon {
        width: 36px;
        height: 36px;
    }
    .site-icon img {
        width: 24px;
        height: 24px;
    }
    .site-icon-fallback {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    .site-name {
        font-size: 14px;
        line-height: 1.3;
    }
    .site-desc {
        font-size: 12px;
        line-height: 1.4;
    }

    /* ===== 详情页内容区移动端优化 ===== */
    .detail-page-content {
        padding: 12px 10px 40px;
    }
    /* ===== 详情页面包屑导航移动端优化 ===== */
    .detail-breadcrumb {
        font-size: 12px;
        padding: 8px 12px;
        margin-bottom: 16px;
        gap: 6px;
        flex-wrap: wrap;
        background: var(--bg-card);
        border-radius: var(--radius-sm);
    }
    .detail-breadcrumb a {
        color: var(--accent);
        font-weight: 500;
        white-space: nowrap;
    }
    .detail-breadcrumb a:hover {
        color: var(--accent-hover);
        text-decoration: underline;
    }
    .detail-breadcrumb i {
        font-size: 9px;
        color: var(--text-muted);
        margin: 0 2px;
    }
    .detail-breadcrumb span {
        color: var(--text-primary);
        font-weight: 500;
        word-break: break-all;
    }
    .detail-header-card {
        padding: 16px 14px;
        gap: 14px;
    }
    .detail-screenshot {
        height: 150px;
    }
    .detail-icon-box {
        height: 150px;
    }
    .detail-h1 {
        font-size: 20px;
        line-height: 1.3;
    }
    .detail-desc-text {
        font-size: 13px;
        line-height: 1.6;
    }
    .detail-tags-label {
        font-size: 12px;
    }
    .detail-go-btn {
        padding: 10px 20px;
        font-size: 14px;
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    .detail-stats-bar {
        gap: 8px;
    }
    .stat-badge {
        padding: 4px 8px;
        font-size: 11px;
    }
    .stat-badge i {
        font-size: 11px;
    }
    .stat-badge span {
        font-size: 12px;
    }
    .detail-rich-content {
        margin: 16px 0;
        padding: 0 2px;
    }
    .detail-rich-content h2 {
        font-size: 17px;
        margin: 20px 0 10px;
    }
    .detail-rich-content p,
    .detail-rich-content li {
        font-size: 13px;
        line-height: 1.7;
    }
    .detail-rich-content img {
        max-width: 100%;
        height: auto;
        border-radius: 6px;
    }

    /* ===== 页脚移动端优化 ===== */
    .footer {
        padding: 20px 12px;
    }
    .footer-inner {
        text-align: center;
    }
    .footer-links {
        justify-content: center;
        gap: 12px;
    }
    .footer-text,
    .footer-icp a {
        font-size: 11px;
    }
}

/* ===== 小屏手机（≤480px）进一步优化 ===== */
@media (max-width: 480px) {
    /* 顶部导航 */
    .top-navbar {
        height: 46px;
    }
    .top-nav-container {
        height: 46px;
    }
    .top-nav-link {
        padding: 5px 10px;
        font-size: 12px;
    }

    /* 悬浮按钮 */
    .float-btn-group {
        bottom: 12px;
        right: 10px;
        gap: 8px;
    }
    .float-sidebar-toggle,
    .float-theme-toggle,
    .back-to-top {
        width: 34px;
        height: 34px;
    }

    /* 相关导航单列 */
    .related-nav-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .related-nav-card {
        flex-direction: row;
        align-items: center;
    }

    /* 详情页 */
    .detail-header-card {
        padding: 14px 12px;
    }
    .detail-screenshot,
    .detail-icon-box {
        height: 140px;
    }
    .detail-h1 {
        font-size: 18px;
    }
    .detail-desc-text {
        font-size: 13px;
    }
    .detail-go-btn {
        padding: 9px 16px;
        font-size: 13px;
    }

    /* 工具卡片 */
    .site-card {
        padding: 8px 10px;
        gap: 8px;
    }
    .site-icon {
        width: 32px;
        height: 32px;
    }
    .site-icon img {
        width: 22px;
        height: 22px;
    }
    .site-name {
        font-size: 13px;
    }
    .site-desc {
        font-size: 11px;
    }
}

/* ============================================
   分类更多页（category.php）移动端优化
   ============================================ */
@media (max-width: 768px) {
    /* 分类标题区 - 标题和返回按钮同行显示 */
    .category-section .section-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }
    .category-section .section-title {
        font-size: 16px;
        flex: 1;
        min-width: 0;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    .category-section .title-count {
        font-size: 11px;
        padding: 1px 6px;
        margin-left: 6px;
    }
    .category-back-link {
        font-size: 12px;
        color: var(--accent);
        padding: 4px 8px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* 工具网格 - 手机端单列布局 */
    .category-section .site-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        max-width: 100%;
    }
    .category-section .site-card {
        padding: 14px 16px;
        gap: 12px;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    .category-section .site-icon {
        width: 44px;
        height: 44px;
        flex-shrink: 0;
    }
    .category-section .site-icon img {
        width: 30px;
        height: 30px;
    }
    .category-section .site-icon-fallback {
        font-size: 18px;
    }
    .category-section .site-info {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        max-width: calc(100% - 56px);
    }
    .category-section .site-name {
        font-size: 15px;
        line-height: 1.4;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    .category-section .site-desc {
        font-size: 12px;
        line-height: 1.5;
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
        white-space: normal;
        margin-top: 4px;
        max-width: 100%;
        word-break: break-all;
    }
    .category-section .new-badge {
        top: 8px;
        right: 8px;
        font-size: 9px;
        padding: 1px 5px;
    }

    /* 空状态 */
    .category-section .empty-state {
        padding: 40px 16px;
    }
    .category-section .empty-icon {
        font-size: 40px;
    }
    .category-section .empty-state p {
        font-size: 14px;
        margin-top: 12px;
    }
}

@media (max-width: 480px) {
    /* 小屏手机单列布局 */
    .category-section .site-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .category-section .site-card {
        padding: 12px 14px;
        gap: 10px;
    }
    .category-section .site-icon {
        width: 40px;
        height: 40px;
    }
    .category-section .site-icon img {
        width: 26px;
        height: 26px;
    }
    .category-section .site-icon-fallback {
        font-size: 16px;
    }
    .category-section .site-name {
        font-size: 14px;
    }
    .category-section .site-desc {
        font-size: 11px;
        -webkit-line-clamp: 2;
    }
    .category-section .section-title {
        font-size: 16px;
    }
}

/* ============================================
   分类更多页（category.php）移动端基础布局修复
   ============================================ */
@media (max-width: 768px) {
    /* 防止水平滚动 */
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    /* 确保主内容区域全宽 */
    .page-main {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden;
    }
    
    /* 主布局容器 */
    .main-layout {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* 内容区域 */
    .content {
        width: 100% !important;
        max-width: 100% !important;
        padding: 12px 8px 36px !important;
        box-sizing: border-box;
    }
    
    /* 分类区块 */
    .category-section {
        width: 100% !important;
        max-width: 100% !important;
        padding: 14px 10px !important;
        margin-bottom: 12px !important;
        box-sizing: border-box;
    }
    
    /* 搜索区域 */
    .search-section {
        padding: 12px 10px !important;
    }
    
    .search-box {
        max-width: 100% !important;
    }
}

@media (max-width: 480px) {
    .content {
        padding: 10px 4px 28px !important;
    }
    
    .category-section {
        padding: 12px 8px !important;
    }
    
    .search-section {
        padding: 10px 8px !important;
    }
}
