/* ============================================ 手机端样式 (默认, < 768px) ============================================ */
@media (max-width: 767px) {
    /* 最重要的一步：将 position: relative 改为 fixed */
    .site-header {
        position: fixed !important; /* 添加 !important 确保覆盖原有样式 */
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 1000 !important;
        background-color: var(--bg-card) !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* 移动端头部样式 - 整体容器 */
    .site-header {
        padding: 0;
    }

    .header-container {
        padding: 0;
    }

    .header-inner {
        flex-wrap: wrap;
        padding: 0;
        gap: 0;
    }

    /* ============================================ 第一行：顶部导航栏 ============================================ */
    .mobile-header-top {
        display: flex;
        width: 100%;
        align-items: center;
        justify-content: space-between;
        padding: 8px 12px;
        background-color: var(--bg-card);
        border-bottom: 1px solid var(--border-color);
        gap: 8px;
        order: 1;
    }

    /* ============================================ PC端元素隐藏 ============================================ */
    .desktop-branding,
    .main-navigation,
    .header-search,
    .header-tools {
        display: none;
    }

    /* ============================================ 用户按钮区域 (左侧) ============================================ */
    .mobile-user-btn {
        flex: 0 0 auto;
    }

    .mobile-user-avatar,
    .mobile-login-btn {
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        border: 1.5px solid var(--border-color);
        background-color: var(--bg-dark);
        transition: all var(--transition-fast);
    }

    .mobile-user-avatar img {
        width: 100%;
        height: 100%;
        border-radius: 50%;
        object-fit: cover;
    }

    .mobile-login-btn {
        color: var(--neon-blue);
        font-size: 14px;
        text-decoration: none;
    }

    .mobile-user-avatar:hover,
    .mobile-login-btn:hover {
        border-color: var(--neon-blue);
        box-shadow: var(--shadow-neon-blue);
        transform: translateY(-2px);
    }

    /* ============================================ 品牌区域 (中间) ============================================ */
    .mobile-brand-area {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        min-width: 0;
        overflow: hidden;
    }

    .mobile-logo-container {
        flex-shrink: 0;
    }

    .mobile-logo {
        max-height: 36px;
        width: auto;
        border-radius: 6px;
    }

    .mobile-title-wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        min-width: 0;
        overflow: hidden;
        flex: 0 1 auto;
    }

    .mobile-site-title {
        margin: 0;
        font-size: 0.9rem;
        line-height: 1.2;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }

    .mobile-site-title a {
        color: var(--neon-blue);
        text-decoration: none;
        display: block;
        font-weight: 700;
    }

    .mobile-site-description {
        margin: 3px 0 0 0;
        font-size: 0.7rem;
        color: var(--text-secondary);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }

    /* ============================================ 搜索按钮区域 (右侧) ============================================ */
    .mobile-search-btn-container {
        flex: 0 0 auto;
    }

    .mobile-search-btn {
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        border: 1.5px solid var(--border-color);
        background-color: var(--bg-dark);
        color: var(--neon-blue);
        font-size: 14px;
        cursor: pointer;
        transition: all var(--transition-fast);
    }

    .mobile-search-btn:hover {
        border-color: var(--neon-blue);
        box-shadow: var(--shadow-neon-blue);
        transform: translateY(-2px);
    }

    /* ============================================ 第二行：导航卡片区域 ============================================ */
    .mobile-nav-cards {
        display: flex;
        width: 100%;
        justify-content: space-between;
        gap: 2px;
        padding: 2px 4px;
        background-color: var(--bg-card);
        border-bottom: none;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        order: 2;
        min-height: 40px;
        max-height: 45px;
        box-sizing: border-box;
    }

    .mobile-nav-cards::-webkit-scrollbar {
        display: none;
    }

    .mobile-nav-cards {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    /* ============================================ 导航卡片样式 ============================================ */
    .mobile-nav-card {
        flex: 1;
        min-width: 0;
        height: 100%;
        min-height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: var(--bg-dark);
        border: 1px solid var(--border-color);
        border-radius: 4px;
        padding: 0;
        text-decoration: none;
        transition: all var(--transition-fast);
        flex-shrink: 0;
        margin: 0;
        box-sizing: border-box;
    }

    .mobile-nav-card:hover {
        border-color: var(--neon-blue);
        background-color: var(--bg-hover);
        transform: translateY(-1px);
        box-shadow: var(--shadow-neon-blue);
    }

    .nav-card-text {
        font-size: 12px;
        color: var(--text-primary);
        text-align: center;
        line-height: 1;
        font-weight: 600;
        padding: 0 2px;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        box-sizing: border-box;
    }

    @supports (-webkit-touch-callout: none) {
        .nav-card-text {
            font-size: 13px;
            -webkit-text-size-adjust: 100%;
        }

        .mobile-nav-cards {
            min-height: 44px;
        }

        .mobile-nav-card {
            min-height: 40px;
        }
    }

    .mobile-nav-card:hover .nav-card-text {
        color: var(--neon-blue);
    }

    /* ============================================ 移动端搜索面板 (模态框) ============================================ */
    .mobile-search-panel {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: var(--bg-dark);
        z-index: 9999;
        padding: 60px 20px 20px;
        transform: translateY(-100%);
        transition: transform var(--transition-normal);
        display: none;
        flex-direction: column;
    }

    .mobile-search-panel.active {
        transform: translateY(0);
        display: flex;
    }

    .mobile-search-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 30px;
    }

    .mobile-search-title {
        font-size: 1.5rem;
        color: var(--neon-blue);
        margin: 0;
    }

    .mobile-search-close {
        width: 50px;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        color: var(--neon-blue);
        font-size: 1.8rem;
        cursor: pointer;
    }

    .mobile-search-form {
        flex: 1;
    }

    .mobile-search-field {
        width: 100%;
        padding: 15px 20px;
        background-color: var(--bg-card);
        border: 2px solid var(--neon-blue);
        border-radius: 10px;
        color: var(--text-primary);
        font-size: 1rem;
        margin-bottom: 20px;
    }

    .mobile-search-field:focus {
        outline: none;
        box-shadow: var(--shadow-neon-blue);
    }

    .mobile-search-submit {
        width: 100%;
        padding: 15px;
        background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
        border: none;
        border-radius: 10px;
        color: var(--text-primary);
        font-size: 1rem;
        font-weight: 700;
        cursor: pointer;
        transition: all var(--transition-fast);
    }

    .mobile-search-submit:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(0, 243, 255, 0.3);
    }

    /* 横屏手机优化 */
    .site-header {
        position: relative;
    }

    .tool-thumbnail {
        height: 150px;
    }
}

/* ============================================ PC端样式 - 隐藏移动端结构 ============================================ */
@media (min-width: 768px) {
    .mobile-header-top,
    .mobile-nav-cards,
    .mobile-search-panel,
    .mobile-search-dropdown,
    .mobile-search-overlay {
        display: none;
    }

    .desktop-branding {
        display: flex;
        align-items: center;
        gap: var(--spacing-sm);
    }

    .main-navigation,
    .header-search,
    .header-tools {
        display: flex;
    }
}

/* ============================================ 移动端搜索下拉面板 ============================================ */
.mobile-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 12px;
    z-index: 1000;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal) ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 0;
    overflow: hidden;
}

.mobile-search-dropdown.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    max-height: 140px;
}

.search-form-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    width: 100%;
}

.mobile-search-input {
    flex: 1;
    padding: 10px 15px;
    background-color: var(--bg-dark);
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.mobile-search-input:focus {
    outline: none;
    border-color: var(--neon-blue);
    box-shadow: 0 0 0 2px rgba(0, 243, 255, 0.2);
}

.mobile-search-submit-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--neon-blue);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.mobile-search-submit-btn:hover {
    background-color: var(--neon-purple);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 243, 255, 0.3);
}

.hot-search-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.hot-search-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-right: 4px;
    flex-shrink: 0;
}

.hot-search-tag {
    padding: 4px 10px;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 0.75rem;
    text-decoration: none;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.hot-search-tag:hover {
    background-color: var(--neon-blue);
    border-color: var(--neon-blue);
    color: white;
    transform: translateY(-2px);
}

.mobile-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.mobile-search-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================ 大屏幕优化 (>= 1400px) ============================================ */
@media (min-width: 1400px) {
    .home-layout {
        grid-template-columns: 200px 800px 300px;
    }

    .tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

/* ============================================ 超大屏幕优化 (>= 1920px) ============================================ */
@media (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }

    .home-layout {
        grid-template-columns: auto 1fr auto;
    }
}

/* ============================================ 打印优化 ============================================ */
@media print {
    .site-header,
    .home-sidebar-left,
    .home-sidebar-right,
    .site-footer,
    .back-to-top,
    .no-print {
        display: none;
    }

    .home-layout {
        grid-template-columns: 1fr;
    }

    .tool-card {
        break-inside: avoid;
    }
}

/* ============================================ 高对比度模式 ============================================ */
@media (prefers-contrast: high) {
    :root {
        --border-color: rgba(0, 243, 255, 0.5);
    }

    .card {
        border-width: 2px;
    }
}

/* ============================================ 减少动画模式 ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms;
        animation-iteration-count: 1;
        transition-duration: 0.01ms;
    }

    .matrix-rain-canvas {
        display: none;
    }
}

/* ============================================ 暗色模式偏好 ============================================ */
@media (prefers-color-scheme: dark) {
    body:not(.light-mode) {
        /* 已在主样式中定义 */
    }
}

/* ============================================ 触摸设备优化 ============================================ */
@media (hover: none) and (pointer: coarse) {
    .tool-btn,
    .category-link,
    .nav-menu a {
        min-height: 44px;
        min-width: 44px;
    }

    .card:hover::before {
        display: none;
    }
}

/* ============================================ 移动端左侧边栏样式 - 修正版 ============================================ */
@media screen and (max-width: 768px) {
    /* 1. 侧边栏整体 - 上移20px，顶部不留空 */
.home-sidebar-left {
    position: fixed;
    top: 99px !important; /* 上移20px */
    left: 0;
    width: 280px;
    
    /* 修改这里：动态高度，底部用padding留空间 */
    height: calc(100vh - 99px) !important; /* 只减去顶部 */
    min-height: 300px; /* 最小高度保证显示 */
    max-height: calc(100vh - 99px - 70px); /* 最大不超过底部按钮 */
    
    background-color: rgba(18, 18, 37, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1001;
    margin: 0;
    padding: 15px;
    padding-bottom: 85px !important; /* 关键：15px内边距 + 70px底部预留 */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);

    /* 默认：完全隐藏 */
    transform: translateX(-100%);
    opacity: 0;
    visibility: hidden;
    
    /* 使用弹性布局自适应 */
    display: flex;
    flex-direction: column;
    
    /* 只加这3行隐藏滚动条 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* 只加这1行隐藏Webkit滚动条 */
.home-sidebar-left::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* 2. 展开状态 */
.home-sidebar-left.expanded {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.4), 0 0 30px rgba(185, 103, 255, 0.1);
    border-right: 1px solid rgba(0, 243, 255, 0.3);
}

/* 3. 折叠状态 - 确保完全隐藏 */
.home-sidebar-left.collapsed {
    transform: translateX(-100%);
    opacity: 0;
    visibility: hidden;
    width: 0;
    height: 0;
    padding: 0;
    margin: 0;
    pointer-events: none;
    overflow: hidden;
}

/* 4. 内部容器调整 - 自适应高度 */
.home-sidebar-left.expanded .sidebar-container {
    height: auto; /* 自适应 */
    width: 100%;
    flex: 1; /* 填满父容器 */
    display: flex;
    flex-direction: column;
}

/* 5. 菜单区域自适应 */
.home-sidebar-left .sidebar {
    flex: 1; /* 填满剩余空间 */
    display: flex;
    flex-direction: column;
    min-height: 0; /* 允许收缩 */
}

/* 6. 菜单列表可滚动 */
.home-sidebar-left .sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 15px; /* 额外的底部空间 */
}

/* 7. iPhone安全区域适配 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .home-sidebar-left {
        padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

    .home-sidebar-left.expanded .sidebar {
        width: 100%;
        height: 100%;
        background: transparent;
        box-shadow: none;
        border: none;
    }

    /* 5. 显示侧边栏顶部的按钮（重要修改！） */
    .home-sidebar-left .sidebar-header,
    .home-sidebar-left .toggle-btn {
        display: block !important; /* 改为显示 */
    }

    /* 6. 移动端调整侧边栏内部按钮样式 */
    .home-sidebar-left.expanded .toggle-btn {
        background: rgba(0, 243, 255, 0.15);
        border: 1px solid rgba(0, 243, 255, 0.3);
        color: #00f3ff;
        padding: 8px 12px;
        margin-bottom: 15px;
    }

    .home-sidebar-left.expanded .toggle-btn-icon {
        background: rgba(0, 243, 255, 0.2);
    }

    /* 7. 按钮位置调整 - 按钮放在最左边 */
    .mobile-brand-area {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .mobile-sidebar-toggle {
        width: 36px;
        height: 36px;
        background: rgba(0, 243, 255, 0.2);
        color: #00f3ff;
        border: 1px solid rgba(0, 243, 255, 0.4);
        border-radius: 6px;
        cursor: pointer;
        font-size: 18px;
        font-weight: bold;
        margin-right: 0 !important; /* 移除右边距 */
        margin-left: 5px; /* 左边加一点间距 */
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
        order: -1; /* 放在最左边 */
    }

    .mobile-sidebar-toggle:hover {
        background: rgba(0, 243, 255, 0.3);
        transform: scale(1.05);
        box-shadow: 0 0 15px rgba(0, 243, 255, 0.3);
    }

    /* 8. 亮色模式适配 */
    body.light-mode .home-sidebar-left {
        background-color: rgba(255, 255, 255, 0.98);
    }

    body.light-mode .home-sidebar-left.expanded {
        border-right-color: rgba(0, 136, 204, 0.3);
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.15), 0 0 30px rgba(123, 63, 184, 0.05);
    }

    body.light-mode .mobile-sidebar-toggle {
        background: rgba(0, 136, 204, 0.15);
        color: #0088cc;
        border-color: rgba(0, 136, 204, 0.3);
    }

    body.light-mode .mobile-sidebar-toggle:hover {
        background: rgba(0, 136, 204, 0.25);
        box-shadow: 0 0 15px rgba(0, 136, 204, 0.2);
    }

    /* 9. 遮罩层也要上移20px */
    .sidebar-mobile-overlay {
        position: fixed;
        top: 100px;
        left: 0;
        width: 100%;
        /* 关键修改：确保在小屏幕也能看到 */
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px); /* 添加最大高度限制 */
        overflow: hidden; /* 防止溢出 */
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(3px);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
        cursor: pointer;
    }

    .home-sidebar-left.expanded ~ .sidebar-mobile-overlay {
        opacity: 1;
        visibility: visible;
    }
}

/* 桌面端隐藏移动端按钮 */
@media screen and (min-width: 769px) {
    .mobile-sidebar-toggle {
        display: none !important;
    }
}

/* ============================================ 隐藏侧边栏按钮区域并消除空白 ============================================ */
@media screen and (max-width: 768px) {
    /* 1. 隐藏整个按钮区域，并移除占位空间 */
    .sidebar-header {
        display: none;
        height: 0;
        min-height: 0;
        padding: 0;
        margin: 0;
        overflow: hidden;
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
    }

    /* 2. 调整菜单区域，填补按钮区域的空间 */
    .sidebar-menu {
        margin-top: 0;
        padding-top: 0;
    }

    /* 3. 调整侧边栏内边距 */
    .sidebar {
        padding-top: 0;
    }

    /* 4. 确保按钮和所有子元素都隐藏 */
    .sidebar-header * {
        display: none;
        height: 0;
        width: 0;
        padding: 0;
        margin: 0;
    }

    /* 5. 调整第一个菜单项的边距 */
    .menu-item:first-child {
        margin-top: 0;
    }
}

/* ============================================ 移动端侧边栏按钮样式调整 ============================================ */
@media screen and (max-width: 768px) {
    /* 按钮容器调整 */
    .mobile-brand-area {
        display: flex;
        align-items: left; /* 垂直居中 */
        gap: 8px; /* 元素间距 */
    }

    /* 按钮样式调整 */
    .mobile-sidebar-toggle {
        width: 32px; /* 更小 */
        height: 32px; /* 更小 */
        background: rgba(0, 243, 255, 0.2);
        color: #00f3ff;
        border: 1px solid rgba(0, 243, 255, 0.4);
        border-radius: 4px; /* 圆角小一点 */
        cursor: pointer;
        font-size: 16px; /* 图标更小 */
        font-weight: bold;
        margin: 0;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
        order: -1; /* 确保在最左边 */
        flex-shrink: 0; /* 防止被压缩 */

        /* 位置微调 - 如果需要可以调整这些值 */
        position: relative;
        top: 2px; /* 向下移动2px */
    }

    /* 悬停效果 */
    .mobile-sidebar-toggle:hover {
        background: rgba(0, 243, 255, 0.3);
        transform: scale(1.05);
        box-shadow: 0 0 12px rgba(0, 243, 255, 0.3);
    }

    /* 亮色模式 */
    body.light-mode .mobile-sidebar-toggle {
        background: rgba(0, 136, 204, 0.15);
        color: #0088cc;
        border-color: rgba(0, 136, 204, 0.3);
    }

    body.light-mode .mobile-sidebar-toggle:hover {
        background: rgba(0, 136, 204, 0.25);
        box-shadow: 0 0 12px rgba(0, 136, 204, 0.2);
    }

    /* 如果需要更靠下，调整容器的对齐方式 */
    .mobile-header-top {
        align-items: flex-start; /* 顶部对齐，让按钮更靠下 */
    }

    /* 或者让按钮单独对齐 */
    .mobile-sidebar-toggle {
        align-self: flex-start; /* 按钮顶部对齐 */
        margin-top: 2px; /* 顶部边距 */
    }
}

/* 如果需要更精确控制，添加这个 */
@media screen and (max-width: 768px) {
    /* 强制按钮在最左边 */
    .mobile-sidebar-toggle {
        margin-right: 0;
        margin-left: 0;
    }

    /* 调整logo和标题位置，给按钮留出空间 */
    .mobile-logo-container,
    .mobile-title-wrapper {
        margin-left: 5px;
    }
}

/* ============================================
   独立左侧边栏遮罩层（区别于搜索遮罩）
   ============================================ */
@media screen and (max-width: 768px) {
    .sidebar-left-overlay {
        position: fixed;
        top: 100px;
        left: 200px;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(4px);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: all 0.3s ease;
        cursor: pointer;
    }

    .sidebar-left-overlay.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
}

/* ============================================ 亮色模式适配 ============================================ */
body.light-mode .sidebar-right-toggle-btn {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--neon-blue);
    color: var(--neon-blue);
}

body.light-mode .home-sidebar-right.collapsed .sidebar-right-toggle-btn {
    background: radial-gradient(circle at center, rgba(0, 136, 204, 0.1) 0%, rgba(0, 136, 204, 0.05) 30%, transparent 70%);
    border-color: #0088cc;
    color: #0088cc;
}

body.light-mode .home-sidebar-right.collapsed .sidebar-right-toggle-btn::before {
    background: radial-gradient(circle, #0088cc, transparent 70%);
}

body.light-mode .home-sidebar-right.collapsed .sidebar-right-toggle-btn::after {
    border-color: #0088cc;
}

body.light-mode .home-sidebar-right.collapsed .sidebar-right-toggle-btn:hover {
    border-color: #7b3fb8;
    color: #7b3fb8;
}

body.light-mode .home-sidebar-right.collapsed .sidebar-right-toggle-btn:hover i {
    color: #7b3fb8;
}

/* ============================================ 网站底部区域响应式 ============================================ */
@media (max-width: 1024px) {
    .nav-links-row {
        gap: 6px;
    }

    .nav-link {
        font-size: 0.75rem;
        padding: 3px 8px;
    }
}

@media (max-width: 768px) {
    .footer-main-card {
        padding: var(--spacing-md);
    }

    .friend-links-row {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 10px;
        gap: 8px;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
    }

    .friend-link {
        flex-shrink: 0;
        font-size: 0.8rem;
        padding: 5px 10px;
    }

    .nav-links-row {
        justify-content: flex-start;
        gap: 8px;
        flex-wrap: wrap;
    }

    .nav-link {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    .footer-info-content {
        gap: var(--spacing-xs);
        align-items: flex-start;
        text-align: left;
    }

    .thanks-info,
    .thanks-text {
        font-size: 0.65rem;
    }

    .copyright-text {
        font-size: 0.7rem;
        white-space: nowrap;
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        gap: 4px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .copyright-text>* {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .icp-separator {
        display: inline;
        white-space: nowrap;
    }
}

@media (max-width: 640px) {
    .friend-links-row {
        gap: 6px;
    }

    .friend-link {
        font-size: 0.75rem;
        padding: 4px 8px;
    }

    .nav-links-row {
        gap: 6px;
        justify-content: flex-start;
    }

    .nav-link {
        font-size: 0.65rem;
        padding: 2px 6px;
    }

    .footer-section-title {
        font-size: 1rem;
        justify-content: flex-start;
        text-align: left;
    }

    .footer-section-title::after {
        left: 0;
        transform: none;
    }

    .thanks-info,
    .thanks-text {
        font-size: 0.65rem;
    }

    .copyright-text {
        font-size: 0.65rem;
        gap: 3px;
    }

    .icp-separator {
        display: inline;
    }
}

/* ============================================ 主内容区域响应式 ============================================ */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
        box-sizing: border-box;
    }

    body {
        padding-top: 120px !important;
    }

    .home-layout {
        display: flex;
        flex-direction: column; /* 改为垂直布局 */
        width: 100%;
        position: relative;
        gap: 20px; /* 区块间距 */
    }

    .home-main-content {
        flex: 1;
        width: 100%;
        margin-left: 0;
        padding: 0 5px;
        box-sizing: border-box;
        order: 1; /* 显示在第一 */
    }

    /* 右侧边栏调整 */
    .home-sidebar-right {
        width: 100% !important;
        max-width: 100% !important;
        order: 2; /* 显示在第二 */
        margin: 0 !important;
        padding: 0 5px !important;
        box-sizing: border-box;
    }

    /* 右侧边栏卡片全宽 */
    .home-sidebar-right .sidebar-right-content.card {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 auto !important;
    }

    /* 如果有其他方式引用左侧边栏也隐藏 */
    .sidebar-left,
    .left-sidebar,
    .primary-sidebar {
        display: none !important;
    }

    /* 修复：确保网格为两列布局 */
    .tools-grid.compact-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
        margin-bottom: 15px !important;
    }

    /* 修复：卡片宽度自适应 - 高度调整为60px */
    .tool-card.compact-card {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        height: 60px !important;
        min-height: 60px !important;
        margin: 0 !important;
    }

    /* 调整两行高度分配：第一行38px + 第二行22px = 总60px */
    .card-first-row {
        height: 38px !important;
        padding: 5px 8px !important;
    }

    .card-second-row {
        height: 22px !important;
        padding: 0 8px 5px 8px !important;
    }

    /* 修复：确保标题和描述显示完整 */
    .compact-title {
        font-size: 0.85rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .compact-desc {
        font-size: 0.7rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    /* 修复：缩略图大小适应 */
    .compact-thumbnail {
        width: 28px !important;
        height: 28px !important;
        margin-right: 6px !important;
        flex-shrink: 0;
    }

    /* 右侧边栏字体调大 */
    .home-sidebar-right .widget-title {
        font-size: 1.1rem !important;
        margin-bottom: 12px !important;
    }

    .home-sidebar-right .widget-title i {
        font-size: 1rem !important;
    }

    .home-sidebar-right .post-title,
    .home-sidebar-right .recommended-title {
        font-size: 0.95rem !important;
        line-height: 1.4 !important;
    }

    /* 数字序号调大 */
    .home-sidebar-right .post-number,
    .home-sidebar-right .rank-number {
        min-width: 26px !important;
        height: 26px !important;
        font-size: 0.9rem !important;
        margin-right: 10px !important;
    }

    /* 列表项调大 */
    .home-sidebar-right .post-item,
    .home-sidebar-right .recommended-item {
        margin-bottom: 10px !important;
    }

    .home-sidebar-right .post-link {
        padding: 10px 8px !important;
        min-height: 44px !important;
    }

    /* 查看更多链接调大 */
    .home-sidebar-right .view-more-link {
        font-size: 0.95rem !important;
        padding: 12px 18px !important;
        margin-top: 15px !important;
        min-height: 44px !important;
    }

    /* 快速链接调大 */
    .home-sidebar-right .quick-link {
        padding: 14px 10px !important;
        min-height: 70px !important;
    }

    .home-sidebar-right .quick-link i {
        font-size: 1.3rem !important;
        margin-bottom: 8px !important;
    }

    .home-sidebar-right .quick-link span {
        font-size: 0.9rem !important;
    }

    /* 星星评分调大 */
    .home-sidebar-right .stars-wrapper {
        font-size: 0.8rem !important;
    }

    .home-sidebar-right .rating-number {
        font-size: 0.8rem !important;
    }

    /* 无内容提示调大 */
    .home-sidebar-right .no-content-tip {
        font-size: 0.9rem !important;
        padding: 15px !important;
    }
}

/* ============================================ 返回顶部按钮响应式 - 手机端 ============================================ */
@media (max-width: 767px) {
    .back-to-top {
  position: fixed;
  bottom: 90px;
  right: 30px;
  width: 50px;
  height: 50px;
  background-color: var(--neon-blue);
  color: var(--bg-dark);
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  box-shadow: 0 4px 20px rgba(0, 243, 255, 0.5);
  z-index: 999;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background-color: var(--neon-purple);
  box-shadow: 0 6px 30px rgba(185, 103, 255, 0.7);
  transform: translateY(-5px);
}
}

/* ============================================ 移动端底部导航 - 极简版 ============================================ */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(18, 18, 37, 0.98);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 243, 255, 0.3);
    z-index: 9999;
    box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    padding: 0 10px;
}

body.light-mode .mobile-bottom-nav {
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid rgba(0, 136, 204, 0.3);
}

.mobile-bottom-nav * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 8px 2px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.nav-btn .btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 243, 255, 0.2);
    transition: all var(--transition-fast);
}

.nav-btn .btn-label {
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: all var(--transition-fast);
}

.nav-btn.active {
    color: var(--neon-blue);
}

.nav-btn.active .btn-icon {
    background: rgba(0, 243, 255, 0.15);
    border-color: var(--neon-blue);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.4);
}

.nav-btn[data-nav="ai"] .btn-icon {
    width: 50px;
    height: 50px;
    font-size: 24px;
    margin-top: -20px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.2), rgba(185, 103, 255, 0.2));
    border: 2px solid var(--neon-purple);
    box-shadow: 0 5px 20px rgba(185, 103, 255, 0.3);
}

/* 核心显示规则 */
@media (max-width: 768px) and (orientation: portrait) {
    .mobile-bottom-nav {
        display: flex;
    }

    body {
        padding-bottom: 70px;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    .mobile-bottom-nav {
        display: none;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .mobile-bottom-nav {
        display: none;
    }
}

@media (min-width: 1025px) {
    .mobile-bottom-nav {
        display: none;
    }
}

/* ============================================ AI助手图标动画效果 ============================================ */
@keyframes pulse {
    0%,
    100% {
        filter: drop-shadow(0 0 5px rgba(0, 243, 255, 0.5));
        transform: scale(1);
    }

    50% {
        filter: drop-shadow(0 0 15px rgba(0, 243, 255, 0.8));
        transform: scale(1.05);
    }
}

.ai-robot-img {
    width: 55px;
    height: 55px;
    object-fit: contain;
    filter: drop-shadow(0 0 5px rgba(0, 243, 255, 0.5));
    animation: pulse 2s ease-in-out infinite;
    transition: all var(--transition-fast);
}

.nav-btn[data-nav="ai"] .btn-icon {
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.2), rgba(185, 103, 255, 0.2));
    border: 2px solid var(--neon-purple);
    border-radius: 50%;
    box-shadow: 0 5px 20px rgba(185, 103, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn[data-nav="ai"]:hover .btn-icon {
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.3), rgba(185, 103, 255, 0.3));
    border-color: var(--neon-blue);
    box-shadow: 0 8px 30px rgba(0, 243, 255, 0.5), 0 0 25px rgba(0, 243, 255, 0.4), inset 0 0 20px rgba(0, 243, 255, 0.3);
}

.nav-btn[data-nav="ai"]:hover .ai-robot-img {
    filter: drop-shadow(0 0 10px rgba(0, 243, 255, 0.8)) brightness(1.3);
    animation-duration: 1.5s;
}

.nav-btn[data-nav="ai"].active .btn-icon {
    animation: ai-btn-glow 2s ease-in-out infinite;
}

@keyframes ai-btn-glow {
    0%,
    100% {
        box-shadow: 0 5px 25px rgba(185, 103, 255, 0.4), 0 0 20px rgba(0, 243, 255, 0.3), inset 0 0 15px rgba(0, 243, 255, 0.2);
    }

    50% {
        box-shadow: 0 10px 40px rgba(0, 243, 255, 0.6), 0 0 30px rgba(0, 243, 255, 0.5), inset 0 0 25px rgba(0, 243, 255, 0.3);
    }
}

.nav-btn[data-nav="ai"] .ai-robot-img.clicked {
    animation: none;
    transform: scale(1.3) rotate(360deg);
    transition: transform 0.5s ease;
}

/* ============================================
   排行榜页面移动端样式 (767px以下)
   ============================================ */
@media (max-width: 767px) {
    /* 排行榜标题区 - 紧凑高度 */
    .rank-page-header {
        height: 30px;
        margin-bottom: 15px;
        padding: 0;
        display: flex;
        align-items: center;
        border: none;
        text-align: left;
    }

    .rank-page-title {
        font-size: 1.2rem;
        margin: 0;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .rank-page-title i.fa-fire {
        color: #ff5500;
        font-size: 1.1rem;
    }

    /* 移除描述文字 */
    .rank-page-description {
        display: none;
    }

    /* 基础布局调整 */
    .rank-page-wrapper {
        padding: 15px;
    }

    /* 全屏显示 */
    .rank-full-content .sidebar-right-content.card {
        max-width: none;
        width: 100%;
        padding: 15px;
    }

    /* 字体变大 */
    .rank-full-content .widget-title {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }

    .rank-full-content .post-title,
    .rank-full-content .recommended-title {
        font-size: 1rem;
        line-height: 1.4;
    }

    /* 数字序号变大 */
    .rank-full-content .post-number,
    .rank-full-content .rank-number {
        min-width: 24px;
        height: 24px;
        font-size: 0.9rem;
        margin-right: 10px;
    }

    /* 查看更多链接 */
    .rank-full-content .view-more-link {
        font-size: 0.95rem;
        padding: 10px 15px;
        margin-top: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
    }

    /* 快速链接调整 */
    .rank-full-content .quick-links-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .rank-full-content .quick-link {
        padding: 12px 8px;
        min-height: 60px;
    }

    .rank-full-content .quick-link i {
        font-size: 1.2rem;
        margin-bottom: 5px;
    }

    .rank-full-content .quick-link span {
        font-size: 0.85rem;
    }

    /* 移除收缩按钮 */
    .rank-full-content .sidebar-right-toggle,
    .rank-full-content .sidebar-right-toggle-btn {
        display: none;
    }
}












/* ========== 强制移动端响应式修复 ========== */

@media (max-width: 768px) {
    /* 修复网格布局 */
    .news-layout {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: 1fr !important;
    }
    
    /* 确保主内容和侧边栏宽度100% */
    .news-main-content,
    .news-sidebar {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* 修复文章网格 */
    .news-featured-grid {
        grid-template-columns: 1fr !important;
    }
    
    .news-list-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* 修复容器溢出 */
    .news-page-wrapper .container {
        padding-left: 15px !important;
        padding-right: 15px !important;
        max-width: 100% !important;
    }
}

@media (max-width: 480px) {
    .news-list-grid {
        grid-template-columns: 1fr !important;
    }
}



/* 针对所有分类导航条的移动端隐藏 */
@media (max-width: 767px) {
    /* archive-ai_tool.php 的分类导航条 */
    .ai-category-nav-wrapper {
        display: none !important;
    }
    
    /* search.php 的分类导航条 */
    .ai-category-page .ai-category-nav-wrapper {
        display: none !important;
    }
    
    /* tag.php 的分类导航条 */
    .ai-category-page .ai-category-nav-wrapper {
        display: none !important;
    }
}
/* ============================================
   移动端响应式样式 - 搜索页面和标签页面
   屏幕宽度小于 768px 时生效
   ============================================ */

@media screen and (max-width: 767px) {
    
    /* === 搜索按钮优化 === */
    .ai-search-page-wrapper .ai-search-submit {
        width: 100%;
        height: 56px;
        padding: 0 20px;
        border-radius: 12px;
        font-size: 1.1rem;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 12px;
        background: linear-gradient(135deg, var(--ai-neon-blue), var(--ai-neon-purple));
        box-shadow: 0 6px 20px rgba(0, 243, 255, 0.4);
    }
    
    .ai-search-page-wrapper .ai-search-submit:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 25px rgba(0, 243, 255, 0.6);
    }
    
    .ai-search-page-wrapper .ai-search-submit i {
        font-size: 1.2rem;
    }
    
    .ai-search-page-wrapper .ai-search-submit:active {
        transform: translateY(1px);
        box-shadow: 0 3px 15px rgba(0, 243, 255, 0.3);
    }
    
    /* === 隐藏分类导航条 === */
    .ai-search-page-wrapper .ai-category-nav-wrapper {
        display: none;
    }
    
    /* === 搜索输入区域布局优化 === */
    .ai-search-page-wrapper .ai-search-input-wrapper {
        flex-direction: column;
        gap: 15px;
    }
    
    /* === 搜索结果网格布局优化 === */
    .ai-search-page-wrapper .ai-search-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* === 侧边栏优化 === */
    .ai-search-page-wrapper .ai-search-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .ai-search-page-wrapper .ai-search-sidebar {
        margin-top: 20px;
    }
    
    /* === 搜索类型按钮优化 === */
    .ai-search-page-wrapper .ai-search-type-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .ai-search-page-wrapper .ai-search-type-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* === 分页优化 === */
    .ai-search-page-wrapper .ai-search-pagination {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .ai-search-page-wrapper .ai-search-pagination .page-numbers {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}












/* AI功能按钮弹窗样式 - 完整版 */
/* 文件名：ai-buttons-modal.css */

/* ======================== */
/* 基础弹窗样式 */
/* ======================== */

/* 简洁遮罩层 */
.ai-arc-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

/* 主按钮容器（第1排） */
.ai-main-buttons-container {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(30px);
    width: 360px;
    height: 160px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.ai-main-buttons-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* 子按钮容器（第2排） */
.ai-sub-row1-container {
    position: fixed;
    bottom: 200px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    width: 360px;
    height: 160px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.ai-sub-row1-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* 子按钮容器（第3排） */
.ai-sub-row2-container {
    position: fixed;
    bottom: 300px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    width: 360px;
    height: 160px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.ai-sub-row2-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* 子按钮容器（第4排） */
.ai-sub-row3-container {
    position: fixed;
    bottom: 400px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    width: 360px;
    height: 160px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 10002;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.ai-sub-row3-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* ======================== */
/* 按钮样式 */
/* ======================== */

/* 通用按钮样式 */
.ai-btn {
    width: 70px;
    height: 70px;
    border-radius: 20px;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    text-decoration: none;
    color: #333;
    text-align: center;
    overflow: hidden;
    z-index: 1;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* 主按钮弹出动画 */
.ai-main-buttons-container.active .ai-btn {
    opacity: 1;
    transform: translateY(0);
}

/* 子按钮弹出动画 */
.ai-sub-row1-container.active .ai-btn,
.ai-sub-row2-container.active .ai-btn,
.ai-sub-row3-container.active .ai-btn {
    opacity: 1;
    transform: translateY(0);
}

/* 延迟动画 - 第1排 */
.ai-main-buttons-container.active .ai-btn:nth-child(1) { transition-delay: 0.1s; }
.ai-main-buttons-container.active .ai-btn:nth-child(2) { transition-delay: 0.2s; }
.ai-main-buttons-container.active .ai-btn:nth-child(3) { transition-delay: 0.3s; }
.ai-main-buttons-container.active .ai-btn:nth-child(4) { transition-delay: 0.4s; }

/* 延迟动画 - 第2排 */
.ai-sub-row1-container.active .ai-btn:nth-child(1) { transition-delay: 0.1s; }
.ai-sub-row1-container.active .ai-btn:nth-child(2) { transition-delay: 0.15s; }
.ai-sub-row1-container.active .ai-btn:nth-child(3) { transition-delay: 0.2s; }
.ai-sub-row1-container.active .ai-btn:nth-child(4) { transition-delay: 0.25s; }

/* 延迟动画 - 第3排 */
.ai-sub-row2-container.active .ai-btn:nth-child(1) { transition-delay: 0.3s; }
.ai-sub-row2-container.active .ai-btn:nth-child(2) { transition-delay: 0.35s; }
.ai-sub-row2-container.active .ai-btn:nth-child(3) { transition-delay: 0.4s; }
.ai-sub-row2-container.active .ai-btn:nth-child(4) { transition-delay: 0.45s; }

/* 延迟动画 - 第4排 */
.ai-sub-row3-container.active .ai-btn:nth-child(1) { transition-delay: 0.5s; }
.ai-sub-row3-container.active .ai-btn:nth-child(2) { transition-delay: 0.55s; }
.ai-sub-row3-container.active .ai-btn:nth-child(3) { transition-delay: 0.6s; }
.ai-sub-row3-container.active .ai-btn:nth-child(4) { transition-delay: 0.65s; }

/* ======================== */
/* 按钮排列 - 统一的弧线布局 */
/* ======================== */

/* 所有按钮的统一排列 */
.ai-btn:nth-child(1) {
    order: 1;
    margin-bottom: 30px;
}

.ai-btn:nth-child(2) {
    order: 2;
    margin-bottom: 60px;
}

.ai-btn:nth-child(3) {
    order: 3;
    margin-bottom: 60px;
}

.ai-btn:nth-child(4) {
    order: 4;
    margin-bottom: 30px;
}

/* 按钮悬停效果 */
.ai-btn:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

/* 图标样式 */
.ai-btn .btn-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    transition: all 0.3s ease;
}

.ai-btn .btn-icon i {
    font-size: 26px;
    line-height: 1;
}

/* 悬停时图标放大 */
.ai-btn:hover .btn-icon {
    transform: scale(1.1);
}

/* 标签样式 */
.ai-btn .btn-label {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    margin-top: 3px;
}

/* 图标颜色 - 主按钮 */
#aiMainBtn1 .btn-icon i { color: #FF9800; }
#aiMainBtn2 .btn-icon i { color: #4CAF50; }
#aiMainBtn3 .btn-icon i { color: #2196F3; }
#aiMainBtn4 .btn-icon i { color: #9C27B0; }

/* 图标颜色 - 子按钮 */
.ai-btn[data-parent="feedback"] .btn-icon i { color: #FF9800; }
.ai-btn[data-parent="share"] .btn-icon i { color: #4CAF50; }
.ai-btn[data-parent="assist"] .btn-icon i { color: #2196F3; }

/* 隐藏不需要的按钮 */
.ai-btn.hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

/* ======================== */
/* 通用弹窗样式 */
/* ======================== */

/* AI通用弹窗样式 */
.ai-common-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: flex-start;
    opacity: 0;
    transition: opacity 0.4s ease;
    padding: 20px;
}

.ai-common-modal-overlay.ai-common-active {
    display: flex;
    opacity: 1;
}

/* 通用弹窗 - 固定300x500px，下移50px */
.ai-common-modal {
    width: 300px;
    height: 500px;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    transform: translateY(20px) scale(0.95);
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    display: flex;
    flex-direction: column;
    margin-top: 100px;
}

.ai-common-modal-overlay.ai-common-active .ai-common-modal {
    transform: translateY(0) scale(1);
}

/* AI动画容器 */
.ai-common-animation-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

/* 弹窗头部 */
.ai-common-modal-header {
    padding: 15px 15px 8px;
    text-align: center;
    position: relative;
    z-index: 2;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.ai-common-modal-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #00f3ff;
}

.ai-common-modal-subtitle {
    font-size: 12px;
    opacity: 0.9;
    line-height: 1.3;
}

/* 弹窗内容区域 */
.ai-common-modal-content {
    padding: 15px;
    position: relative;
    z-index: 2;
    overflow-y: auto;
    flex: 1;
}

/* 弹窗底部 */
.ai-common-modal-footer {
    padding: 10px 15px 15px;
    background: rgba(0, 0, 0, 0.15);
    text-align: center;
    position: relative;
    z-index: 2;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

/* 关闭按钮 */
.ai-common-close-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 80px;
}

.ai-common-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 粒子效果 */
.ai-common-particles {
    position: absolute;
    width: 100%;
    height: 100%;
}

.ai-common-particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #00b4db;
    border-radius: 50%;
    box-shadow: 0 0 4px #00b4db;
    animation: ai-common-particle-float 3s ease-in-out infinite;
}

/* AI文字炫酷动画效果 */
.ai-common-ai-text {
    position: absolute;
    font-size: 70px;
    font-weight: 900;
    color: rgba(0, 180, 219, 0.1);
    background: linear-gradient(135deg, 
        rgba(0, 180, 219, 0.1) 0%, 
        rgba(0, 243, 255, 0.15) 50%, 
        rgba(0, 180, 219, 0.1) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 3px;
    pointer-events: none;
    z-index: 1;
    animation: aiTextGlow 6s ease-in-out infinite;
    text-shadow: 
        0 0 10px rgba(0, 180, 219, 0.3),
        0 0 20px rgba(0, 180, 219, 0.2),
        0 0 30px rgba(0, 180, 219, 0.1);
}

.ai-common-ai-text:nth-child(1) {
    top: 15%;
    left: 10%;
    animation-delay: 0s;
    transform: rotate(-5deg);
    --rotation: -5deg;
}

.ai-common-ai-text:nth-child(2) {
    bottom: 20%;
    right: 10%;
    animation-delay: 3s;
    animation-duration: 7s;
    transform: rotate(5deg);
    --rotation: 5deg;
}

/* ======================== */
/* 弹窗内容组件样式 */
/* ======================== */

/* 目录组件样式 */
.ai-toc-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ai-toc-header {
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(0, 243, 255, 0.1);
    border-radius: 8px;
    border-left: 3px solid #00f3ff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-toc-header span:first-child {
    color: #00f3ff;
    font-size: 13px;
}

.ai-toc-header span:nth-child(2) {
    color: #fff;
    font-size: 14px;
    margin-left: 8px;
}

.ai-toc-scroll-hint {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}

.ai-toc-item {
    display: block;
    margin-bottom: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid #00f3ff;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.ai-toc-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(3px);
}

.ai-toc-item[data-level="h3"] {
    border-left-color: #667eea;
}

.ai-toc-number {
    color: #a0aec0;
    font-size: 13px;
    margin-right: 10px;
    min-width: 20px;
    text-align: center;
}

.ai-toc-item[data-level="h2"] .ai-toc-number {
    color: #00f3ff;
}

.ai-toc-content {
    flex: 1;
}

.ai-toc-title {
    color: #fff;
    font-size: 14px;
    margin-bottom: 3px;
}

.ai-toc-meta {
    display: flex;
    align-items: center;
}

.ai-toc-tag {
    padding: 1px 6px;
    background: rgba(0, 243, 255, 0.2);
    border-radius: 3px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
}

.ai-toc-tag.h3 {
    background: rgba(102, 126, 234, 0.2);
}

.ai-toc-footer {
    margin-top: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    text-align: center;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.ai-toc-footer small {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}

.ai-modal-no-toc {
    text-align: center;
    padding: 60px 20px;
}

.ai-modal-no-toc i {
    font-size: 48px;
    color: #00f3ff;
    margin-bottom: 20px;
}

.ai-modal-no-toc p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin-bottom: 10px;
}

.ai-modal-no-toc small {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}

.ai-toc-highlight {
    background-color: rgba(255, 236, 153, 0.3) !important;
    transition: background-color 1s;
}

/* 笔记组件样式 */
.ai-notes-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ai-notes-header {
    margin-bottom: 10px;
    padding: 10px;
    background: rgba(0, 243, 255, 0.1);
    border-radius: 8px;
    border-left: 3px solid #00f3ff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-notes-header span:first-child {
    color: #00f3ff;
    font-size: 13px;
}

.ai-notes-header span:nth-child(2) {
    color: #fff;
    font-size: 14px;
    margin-left: 8px;
}

.ai-notes-counter {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}

.ai-notes-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ai-notes-textarea {
    flex: 1;
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(0, 243, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    resize: none;
    font-size: 14px;
    line-height: 1.5;
    font-family: inherit;
}

.ai-notes-textarea:focus {
    outline: none;
    border-color: #00f3ff;
}

.ai-notes-info {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-notes-char-counter {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
}

.ai-notes-auto-save {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
}

.ai-notes-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.ai-notes-save-btn {
    flex: 2;
    padding: 12px;
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.4) 0%, rgba(39, 174, 96, 0.4) 100%);
    border: 1px solid rgba(46, 204, 113, 0.6);
    border-radius: 16px;
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    font-family: inherit;
}

.ai-notes-save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.3);
}

.ai-notes-clear-btn {
    flex: 1;
    padding: 12px;
    background: rgba(231, 76, 60, 0.3);
    border: 1px solid rgba(231, 76, 60, 0.5);
    border-radius: 16px;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
}

.ai-notes-clear-btn:hover {
    background: rgba(231, 76, 60, 0.4);
}

.ai-notes-hint {
    margin-top: 15px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.ai-notes-hint small {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    line-height: 1.4;
}

/* 字体调整组件样式 */
.ai-font-modal {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ai-font-header {
    text-align: center;
    margin-bottom: 30px;
}

.ai-font-header i {
    font-size: 48px;
    color: #00f3ff;
    margin-bottom: 10px;
}

.ai-font-header h3 {
    color: #fff;
    margin-bottom: 10px;
    font-size: 18px;
}

.ai-font-header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    line-height: 1.5;
}

.ai-font-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    margin-bottom: 30px;
}

.ai-font-decrease-btn,
.ai-font-increase-btn {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    border: none;
    font-family: inherit;
}

.ai-font-decrease-btn {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.4) 0%, rgba(192, 57, 43, 0.4) 100%);
    border: 2px solid rgba(231, 76, 60, 0.6);
}

.ai-font-increase-btn {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.4) 0%, rgba(39, 174, 96, 0.4) 100%);
    border: 2px solid rgba(46, 204, 113, 0.6);
}

.ai-font-decrease-btn:hover,
.ai-font-increase-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.4);
}

.ai-font-increase-btn:hover {
    box-shadow: 0 8px 25px rgba(46, 204, 113, 0.4);
}

.ai-font-decrease-btn i,
.ai-font-increase-btn i {
    font-size: 28px;
    margin-bottom: 5px;
}

.ai-font-decrease-btn span,
.ai-font-increase-btn span {
    font-size: 12px;
    font-weight: 500;
}

.ai-font-current {
    text-align: center;
    min-width: 80px;
}

.ai-font-size {
    font-size: 24px;
    color: #00f3ff;
    font-weight: bold;
}

.ai-font-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 3px;
}

.ai-font-slider-container {
    width: 100%;
    max-width: 250px;
    margin-top: 20px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-font-slider-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.ai-font-slider-labels span {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
}

.ai-font-slider {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    position: relative;
}

.ai-font-slider-thumb {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: #00f3ff;
    border-radius: 50%;
    top: -3px;
}

.ai-font-slider-values {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
}

.ai-font-slider-values span {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
}

.ai-font-slider-values span:nth-child(2) {
    color: #00f3ff;
}

.ai-font-hint {
    margin-top: 25px;
    padding: 10px;
    background: rgba(0, 243, 255, 0.1);
    border-radius: 8px;
    width: 100%;
}

.ai-font-hint p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    text-align: center;
    line-height: 1.4;
    margin: 0;
}

.ai-font-hint i {
    color: #00f3ff;
    margin-right: 5px;
}

/* 相关文章组件样式 */
.ai-related-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ai-related-header {
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(0, 243, 255, 0.1);
    border-radius: 8px;
    border-left: 3px solid #00f3ff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-related-header span:first-child {
    color: #00f3ff;
    font-size: 13px;
}

.ai-related-header span:nth-child(2) {
    color: #fff;
    font-size: 14px;
    margin-left: 8px;
}

.ai-related-count {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}

.ai-related-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}

.ai-related-item {
    display: block;
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: flex-start;
}

.ai-related-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 243, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.ai-related-index {
    width: 24px;
    height: 24px;
    background: #FF6B6B;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    margin-right: 10px;
    flex-shrink: 0;
}

.ai-related-details {
    flex: 1;
}

.ai-related-title {
    font-weight: 600;
    color: #fff;
    font-size: 14px;
    margin-bottom: 5px;
    line-height: 1.3;
}

.ai-related-excerpt {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 5px;
}

.ai-related-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-related-date {
    color: rgba(255, 255, 255, 0.5);
    font-size: 10px;
}

.ai-related-date i {
    margin-right: 3px;
}

.ai-related-link {
    color: #00f3ff;
    font-size: 11px;
    font-weight: 500;
}

.ai-related-link i {
    font-size: 9px;
}

.ai-related-footer {
    margin-top: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    text-align: center;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.ai-related-footer small {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    line-height: 1.4;
}

.ai-related-footer i {
    margin-right: 5px;
}

.ai-related-empty,
.ai-related-error {
    text-align: center;
    padding: 40px 20px;
}

.ai-related-empty i,
.ai-related-error i {
    font-size: 48px;
    margin-bottom: 15px;
}

.ai-related-empty i {
    color: #00f3ff;
}

.ai-related-error i {
    color: #ff6b6b;
}

.ai-related-empty h3,
.ai-related-error h3 {
    color: #fff;
    margin-bottom: 10px;
    font-size: 16px;
}

.ai-related-empty p,
.ai-related-error p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    margin-bottom: 20px;
}

.ai-related-retry-btn {
    padding: 8px 16px;
    background: rgba(0, 243, 255, 0.2);
    border: 1px solid rgba(0, 243, 255, 0.4);
    border-radius: 16px;
    color: #00f3ff;
    cursor: pointer;
    font-size: 12px;
    border: none;
    font-family: inherit;
}

.ai-related-retry-btn i {
    margin-right: 5px;
    font-size: 12px;
}

.ai-related-loading {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.ai-related-loading-content {
    text-align: center;
}

.ai-related-loading-content i {
    font-size: 48px;
    color: #00f3ff;
    margin-bottom: 15px;
}

.ai-related-loading-content h3 {
    color: #fff;
    margin-bottom: 10px;
    font-size: 18px;
}

.ai-related-loading-content p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.ai-related-loading-bar {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin: 20px auto 0;
}

.ai-related-loading-progress {
    width: 60%;
    height: 100%;
    background: #00f3ff;
    border-radius: 2px;
    animation: loadingBar 1.5s ease-in-out infinite;
}

/* Toast通知样式 */
.ai-toast-notification {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    z-index: 10010;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: fadeInOut 2s ease-in-out;
}

.ai-toast-notification[data-type="success"] {
    background: #51cf66;
}

.ai-toast-notification[data-type="error"] {
    background: #ff6b6b;
}

.ai-toast-notification[data-type="warning"] {
    background: #ffd43b;
}

.ai-toast-notification[data-type="info"] {
    background: #4dabf7;
}

/* ======================== */
/* 动画关键帧 */
/* ======================== */

@keyframes ai-common-particle-float {
    0%, 100% { 
        transform: translate(0, 0); 
        opacity: 0;
    }
    10%, 90% { opacity: 0.6; }
    50% { 
        transform: translate(var(--ai-common-tx, 40px), var(--ai-common-ty, -40px));
        opacity: 0;
    }
}

@keyframes aiTextGlow {
    0%, 100% {
        opacity: 0.1;
        transform: scale(1) rotate(var(--rotation, 0deg)) translate(0, 0);
        filter: blur(0px);
    }
    50% {
        opacity: 0.3;
        transform: scale(1.05) rotate(calc(var(--rotation, 0deg) + 2deg)) translate(5px, -5px);
        filter: blur(0.5px);
    }
}

@keyframes loadingBar {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(200%); }
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    85% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* ======================== */
/* 响应式调整 */
/* ======================== */

@media (max-width: 380px) {
    .ai-common-modal {
        width: 280px;
        height: 450px;
        margin-top: 80px;
    }
    
    .ai-main-buttons-container,
    .ai-sub-row1-container,
    .ai-sub-row2-container,
    .ai-sub-row3-container {
        width: 320px;
    }
}

@media (max-width: 320px) {
    .ai-common-modal {
        width: 260px;
        height: 420px;
        margin-top: 70px;
    }
    
    .ai-main-buttons-container,
    .ai-sub-row1-container,
    .ai-sub-row2-container,
    .ai-sub-row3-container {
        width: 300px;
    }
    
    .ai-btn {
        width: 65px;
        height: 65px;
    }
}