/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
    -webkit-text-size-adjust: 100%;
}

/* Header Styles */
.header {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 60px;
    display: flex;
    align-items: center;
    padding: 15px 20px;
}

/* Menu Toggle Button */
.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 24px;
    height: 18px;
    cursor: pointer;
    margin-right: 15px;
    position: relative;
    z-index: 1001;
    padding: 5px;
    box-sizing: content-box;
}

.menu-line {
    display: block;
    width: 100%;
    height: 2.5px;
    background-color: #333;
    border-radius: 1px;
    transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}

.header-title {
    flex: 0 0 auto;
    margin-right: 40px;
    position: relative;
    z-index: 10;
}

.logo-link {
    text-decoration: none;
}

.header-title h1 {
    color: #2c3e50;
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.main-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nav-list {
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: center;
    padding: 0;
    margin: 0;
    list-style: none;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #4A90E2;
    text-decoration: none;
    font-size: 1.1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: rgba(74, 144, 226, 0.1);
    transform: translateY(-2px);
}

.nav-item.active .nav-link {
    background: rgba(74, 144, 226, 0.15);
    color: #4A90E2;
    font-weight: 500;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #3498db;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto;
    padding: 0 15px;
}

.user-name {
    display: flex;
    align-items: center;
    padding: 8px 15px;
    background: rgba(74, 144, 226, 0.1);
    border-radius: 20px;
    color: #4A90E2;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    text-decoration: none !important;
}

.user-name::before {
    content: '👤';
    margin-right: 6px;
    font-size: 1.1rem;
}

.user-name:hover {
    background: rgba(74, 144, 226, 0.15);
    transform: translateY(-1px);
}

.auth-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 20px;
    background: #4A90E2;
    color: white;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.auth-btn:hover {
    background: #357ABD;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.2);
}

/* 导航图标 */
.nav-link::before {
    margin-right: 8px;
    font-size: 1.2rem;
}

.nav-item:nth-child(1) .nav-link::before { content: '📋'; }
.nav-item:nth-child(2) .nav-link::before { content: '👅'; }
.nav-item:nth-child(3) .nav-link::before { content: '🔍'; }
.nav-item:nth-child(4) .nav-link::before { content: '📝'; }
.nav-item:nth-child(5) .nav-link::before { content: '🌿'; }
.nav-item:nth-child(6) .nav-link::before { content: '☯️'; }
.nav-item:nth-child(7) .nav-link::before { content: '📊'; }
.nav-item:nth-child(8) .nav-link::before { content: '🤖'; }

/* 知识库权限图标样式 */
.access-icon::before {
    content: '📊' !important;
}

/* Main Content Area */
.main-content {
    margin-top: 80px;
    min-height: calc(100vh - 80px);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Mobile and WebView Styles */
@media (max-width: 768px) {
    .header {
        padding: 0 10px;
    }

    .menu-toggle {
        display: flex !important;
        margin-left: 10px;
        margin-right: 8px;
        flex-shrink: 0;
    }
    
    .header-title {
        margin-left: 0;
        margin-right: 5px;
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        position: relative;
        z-index: 10;
    }

    .header-title h1 {
        color: #2c3e50;
        margin: 0;
        font-size: 1.2rem;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .main-nav {
        position: fixed !important;
        z-index: 1000;
        background: #fff;
        visibility: hidden;
        opacity: 0;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .header.menu-open .main-nav {
        visibility: visible;
        opacity: 1;
    }
    
    .nav-list {
        padding: 10px !important;
    }

    .header.menu-open .menu-toggle .menu-line:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }

    .header.menu-open .menu-toggle .menu-line:nth-child(2) {
        opacity: 0;
        transform: translateX(-100%);
    }

    .header.menu-open .menu-toggle .menu-line:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }

    .nav-item {
        width: 90%;
        margin: 5px 0;
        border-radius: 10px;
        overflow: hidden;
    }

    .nav-link {
        width: 100%;
        justify-content: flex-start;
        padding: 16px;
        font-size: 16px;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: #f7f9fc;
        border-radius: 10px;
    }

    .nav-link::before {
        display: block;
        margin-right: 15px;
        font-size: 1.3rem;
    }

    .nav-link:hover {
        transform: none;
        background-color: #e6f2ff;
    }

    .nav-item.active .nav-link {
        background: rgba(74, 144, 226, 0.15);
        color: #4A90E2;
        font-weight: 500;
    }

    .nav-item.active::after {
        display: none;
    }

    .user-actions {
        margin-left: auto;
        margin-right: 10px;
    }

    .auth-btn {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
}

/* 全屏菜单优化 */
@media (max-width: 480px) {
    .header {
        height: 50px;
    }

    .main-nav {
        position: fixed;
        z-index: 999;
        top: 50px;
        left: 0;
        width: 100%;
        height: calc(100vh - 50px);
        background: rgba(248, 249, 250, 0.98);
        overflow-y: auto;
    }
    
    /* 确保菜单项始终可点击 */
    .webview .nav-item {
        touch-action: auto;
        cursor: pointer;
    }
    
    .webview .nav-link {
        touch-action: auto;
        cursor: pointer;
    }
    
    /* 移除可能阻碍点击的元素 */
    .webview .nav-link::before {
        pointer-events: none;
    }
    
    /* 增加点击区域大小 */
    .webview .nav-item {
        padding: 0;
        margin: 8px;
    }
    
    /* 修复点击穿透问题 */
    .webview .fullscreen-menu .main-content::before {
        pointer-events: none;
    }

    /* 调整为全屏网格菜单 */
    .webview .main-nav {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        padding: 0;
        background: #f8f9fa;
        height: calc(100vh - 50px);
    }

    .webview .nav-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 15px;
        justify-content: center;
    }
    
    .webview .nav-item {
        width: 100%;
        height: auto;
        aspect-ratio: 1/1;
        max-width: none;
        max-height: none;
        margin: 0;
        padding: 0;
        border-radius: 10px;
        background-color: #f7f9fc;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
        overflow: hidden;
    }
    
    .webview .nav-item.active {
        background-color: rgba(74, 144, 226, 0.1);
    }
    
    .webview .nav-link {
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 0;
        color: #333;
    }
    
    .webview .nav-link::before {
        content: '';
        display: block;
        width: 60px;
        height: 60px;
        margin-bottom: 10px;
        background-position: center;
        background-size: contain;
        background-repeat: no-repeat;
    }
    
    .webview .nav-item:nth-child(1) .nav-link::before {
        content: '📋';
        font-size: 40px;
        line-height: 1;
        margin-bottom: 10px;
    }
    
    .webview .nav-item:nth-child(2) .nav-link::before {
        content: '👅';
        font-size: 40px;
        line-height: 1;
        margin-bottom: 10px;
    }
    
    .webview .nav-item:nth-child(3) .nav-link::before {
        content: '🔍';
        font-size: 40px;
        line-height: 1;
        margin-bottom: 10px;
    }
    
    .webview .nav-item:nth-child(4) .nav-link::before {
        content: '📝';
        font-size: 40px;
        line-height: 1;
        margin-bottom: 10px;
    }
    
    .webview .nav-item:nth-child(5) .nav-link::before {
        content: '🌿';
        font-size: 40px;
        line-height: 1;
        margin-bottom: 10px;
    }
    
    .webview .nav-item:nth-child(6) .nav-link::before {
        content: '☯️';
        font-size: 40px;
        line-height: 1;
        margin-bottom: 10px;
    }
    
    .webview .nav-item:nth-child(7) .nav-link::before {
        content: '📊';
        font-size: 40px;
        line-height: 1;
        margin-bottom: 10px;
    }
    
    .webview .nav-item:nth-child(8) .nav-link::before {
        content: '🤖';
        font-size: 40px;
        line-height: 1;
        margin-bottom: 10px;
    }
    
    .webview .nav-link span {
        display: block;
        width: 100%;
        font-size: 16px;
        color: #333;
        text-align: center;
    }
    
    /* 移除原来的导航图标样式 */
    .webview .nav-link::before {
        margin-right: 0;
    }
    
    .main-content {
        margin-top: 60px;
    }

    .menu-toggle {
        margin-left: 10px !important;
        margin-right: 8px !important;
        flex-shrink: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-around !important;
        width: 24px !important;
        height: 18px !important;
        cursor: pointer !important;
        position: relative !important;
        z-index: 1001 !important;
        padding: 5px !important;
        box-sizing: content-box !important;
    }

    .header-title {
        margin-left: 0 !important;
        margin-right: 5px !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .header-title h1 {
        font-size: 18px;
        margin-left: 0px;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
}

/* 针对不同尺寸设备的菜单优化 */
@media (max-width: 360px) {
    .webview .nav-list {
        gap: 12px;
        padding: 15px;
    }
}

/* H5菜单特殊样式 */
.webview .nav-list {
    padding: 10px;
}

.webview .nav-item {
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

.webview .nav-item:active {
    transform: scale(0.98);
}

.webview .nav-link {
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

.webview .nav-link span {
    position: relative;
    z-index: 5; 
    pointer-events: none; /* 允许事件穿透到链接元素 */
}

/* Android WebView Specific Styles */
.android-webview {
    -webkit-overflow-scrolling: touch;
}

.android-webview .header {
    position: sticky;
}

.android-webview .nav-link {
    padding: 15px 20px;  /* 增大点击区域 */
    -webkit-tap-highlight-color: rgba(0,0,0,0.05);
}

.android-webview .logout-btn {
    padding: 8px 16px;  /* 增大点击区域 */
}

/* Dark Mode for Mobile */
@media (prefers-color-scheme: dark) {
    .menu-toggle .menu-line {
        background-color: #fff;
    }

    @media (max-width: 768px) {
        .main-nav {
            background: #2c3e50;
        }

        .nav-list {
            background: #2c3e50;
        }

        .nav-link {
            color: #78a7e4;
        }

        .nav-item.active .nav-link {
            background: rgba(74, 144, 226, 0.2);
            color: #78a7e4;
        }
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #fff;
    }

    .header {
        background: #2c3e50;
    }

    .header-title h1 {
        color: #fff;
    }

    .nav-link {
        color: #78a7e4;
    }

    .nav-item.active .nav-link {
        background: rgba(74, 144, 226, 0.2);
        color: #78a7e4;
    }

    .nav-link:hover {
        background-color: rgba(52, 152, 219, 0.2);
    }
}

/* 搜索框样式 */
.search-box {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.search-box input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.search-box select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    min-width: 120px;
}

.search-box button {
    padding: 8px 20px;
    background: #2c3e50;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.search-box button:hover {
    background: #34495e;
}

/* 卡片样式 */
.card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

.card h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 18px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.card p {
    margin: 10px 0;
    line-height: 1.8;
}

.card .label {
    color: #666;
    font-weight: bold;
    margin-right: 10px;
    display: inline-block;
    min-width: 80px;
}

.error {
    text-align: center;
    color: #666;
    padding: 20px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .container {
        padding: 5px;
    }

    h1 {
        font-size: 20px;
    }

    .search-box {
        padding: 10px;
    }

    .search-box input,
    .search-box select,
    .search-box button {
        width: 100%;
    }

    .card {
        padding: 15px;
    }

    .card .label {
        display: block;
        margin-bottom: 5px;
    }
}

/* WebView 特殊适配 */
.webview {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #eee;
    }

    .search-box,
    .card,
    .error {
        background: #2d2d2d;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }

    .card h3 {
        color: #fff;
        border-bottom-color: #444;
    }

    .card .label {
        color: #999;
    }

    input, select {
        background: #333;
        color: #fff;
        border-color: #444;
    }
}

/* 头部样式 */
.main-header {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    padding: 10px 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
}

.site-title {
    margin: 0;
    font-size: 24px;
    color: #2196F3;
}

/* 导航栏样式 */
.main-nav {
    margin-left: auto;
}

.main-nav ul {
    display: flex;
    gap: 15px;
    list-style: none;
    margin: 0;
    padding: 0;
    justify-content: center;
}

.main-nav a {
    color: #333;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.main-nav a:hover {
    background: #e3f2fd;
    color: #1976D2;
}

.logout-btn {
    background: #f44336;
    color: white !important;
}

.logout-btn:hover {
    background: #d32f2f !important;
}

/* 页脚样式 */
.main-footer {
    background: #fff;
    padding: 20px 0;
    margin-top: 40px;
    text-align: center;
    color: #666;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .main-nav ul {
        flex-direction: column;
        align-items: center;
    }

    .main-nav a {
        display: block;
        width: 100%;
        text-align: center;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    .main-header,
    .main-footer {
        background: #2d2d2d;
    }

    .site-title {
        color: #64b5f6;
    }

    .main-nav a {
        color: #eee;
    }

    .main-nav a:hover {
        background: #3d3d3d;
        color: #64b5f6;
    }

    .main-nav li.active a {
        background: #1976D2;
    }

    .main-footer {
        color: #999;
    }
}

/* Add smooth transitions */
* {
    transition: all 0.3s ease;
}

/* Welcome Section Styles */
.welcome-section {
    text-align: center;
    padding: 40px 0;
}

.welcome-section h2 {
    color: #2c3e50;
    font-size: 2rem;
    margin-bottom: 20px;
}

.intro-text {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 40px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    padding: 20px;
}

.feature-card {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.feature-card h3 {
    color: #2c3e50;
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.feature-card p {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.6;
}

.feature-link {
    display: inline-block;
    padding: 10px 20px;
    background: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.feature-link:hover {
    background: #2980b9;
}

/* Dark Mode Support for Welcome Section */
@media (prefers-color-scheme: dark) {
    .welcome-section h2 {
        color: #fff;
    }

    .intro-text {
        color: #ccc;
    }

    .feature-card {
        background: #2d2d2d;
    }

    .feature-card h3 {
        color: #fff;
    }

    .feature-card p {
        color: #ccc;
    }

    .feature-link {
        background: #3498db;
    }

    .feature-link:hover {
        background: #2980b9;
    }
}

/* Mobile Responsive for Welcome Section */
@media (max-width: 768px) {
    .welcome-section {
        padding: 20px 0;
    }

    .welcome-section h2 {
        font-size: 1.5rem;
    }

    .intro-text {
        font-size: 1rem;
    }

    .feature-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 10px;
    }

    .feature-card {
        padding: 20px;
    }
}

/* Android WebView 菜单优化样式 */
.android-webview .header {
    -webkit-overflow-scrolling: touch;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.android-webview .menu-toggle {
    -webkit-tap-highlight-color: transparent;
    padding: 25px;
    margin: -25px 0 -25px -25px;
}

.android-webview .nav-link {
    -webkit-tap-highlight-color: transparent;
    padding: 15px 10px;
    transition: background-color 0.2s ease;
}

.android-webview .nav-link.touch-active {
    background-color: rgba(0, 0, 0, 0.05);
}

.android-webview .nav-list {
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.android-webview.menu-open {
    overflow: hidden;
}

/* 适配不同尺寸的安卓设备 */
@media screen and (max-width: 360px) {
    .android-webview .header-title h1 {
        font-size: 16px;
    }
    
    .android-webview .nav-link {
        padding: 12px 8px;
        font-size: 14px;
    }
}

/* 确保菜单滚动不影响页面 */
.android-webview .main-nav {
    overscroll-behavior: contain;
}

/* 防止菜单打开时页面滚动 */
body.menu-active {
    overflow: hidden;
}

/* 增强H5显示效果 - 菜单项自适应缩放 */
@media (max-width: 480px) {
    .webview .nav-list {
        display: grid;
        /* 使用auto-fit和minmax实现灵活列数和尺寸 */
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); 
        gap: clamp(10px, 3vw, 20px); /* 间距根据视口宽度动态调整，最小10px，最大20px */
        padding: clamp(10px, 3vw, 20px);
        width: 100%;
        box-sizing: border-box;
    }
    
    .webview .nav-item {
        width: 100%;
        margin: 0;
        aspect-ratio: 1 / 1; /* 保持正方形 */
        border-radius: 12px;
        background-color: #f7f9fc;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
        overflow: hidden;
        display: flex; /* 用于内部元素对齐 */
        flex-direction: column;
        align-items: center;
        justify-content: center;
        transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
    }

    .webview .nav-item:active {
        transform: scale(0.97);
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    }
    
    .webview .nav-item.active {
        background-color: rgba(74, 144, 226, 0.1);
        box-shadow: 0 2px 8px rgba(74, 144, 226, 0.15);
    }
    
    .webview .nav-link {
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: clamp(8px, 2vw, 15px); /* 内边距也动态调整 */
        color: #333;
        text-decoration: none;
        overflow: hidden; /* 防止内容溢出 */
    }
    
    /* 图标使用emoji字符，其大小受font-size影响 */
    .webview .nav-link::before {
        font-size: clamp(28px, 7vw, 48px); /* 字体大小动态调整 */
        line-height: 1.1;
        margin-bottom: clamp(5px, 1.5vw, 10px);
        display: block;
        text-align: center;
    }
    
    .webview .nav-link span {
        display: block;
        width: 100%;
        font-size: clamp(12px, 3.5vw, 16px); /* 文字大小动态调整 */
        color: #333;
        text-align: center;
        line-height: 1.3;
        overflow: hidden; /* 防止文字溢出 */
        text-overflow: ellipsis; /* 文字过长时显示省略号 */
        white-space: nowrap; /* 禁止文字换行，配合ellipsis */
    }
}

/* 针对非常小的屏幕，可以考虑单列布局或进一步减小尺寸 */
@media (max-width: 320px) {
    .webview .nav-list {
        grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
        gap: 8px;
        padding: 8px;
    }
    .webview .nav-link::before {
        font-size: clamp(24px, 6vw, 40px);
        margin-bottom: 4px;
    }
    .webview .nav-link span {
        font-size: clamp(11px, 3vw, 14px);
    }
}

/* 确保在Android设备上的特殊处理 */
.android-webview .nav-item,
.android-webview .nav-link,
.android-webview .nav-link span {
    cursor: pointer !important;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    touch-action: manipulation;
}

/* 强制菜单可见和可点击 */
html.fullscreen-menu .main-nav,
body.menu-active .main-nav {
    visibility: visible !important;
    opacity: 1 !important;
    max-height: 100vh !important;
    pointer-events: auto !important;
}

/* 增加菜单点击区域 */
.menu-hitbox {
    position: absolute;
    top: -10px;
    left: -10px;
    width: calc(100% + 20px);
    height: calc(100% + 20px);
    z-index: 10;
    cursor: pointer;
}

.android-webview .menu-hitbox {
    top: -20px;
    left: -20px;
    width: 80px;
    height: 80px;
}

/* 在较小的屏幕上进一步扩大点击区域 */
@media (max-width: 360px) {
    .menu-hitbox {
        top: -20px;
        left: -20px;
        width: 80px;
        height: 80px;
    }
    
    .android-webview .menu-hitbox {
        top: -25px;
        left: -25px;
        width: 90px;
        height: 90px;
    }
}

/* 确保在所有背景下都能看到菜单按钮 */
.webview .menu-toggle svg {
    fill: none;
    stroke: #333;
    stroke-width: 2;
}

/* 确保菜单按钮始终可见 */
.android-webview .menu-toggle,
.ios-webview .menu-toggle {
    display: flex !important;
    opacity: 1 !important;
    z-index: 1999 !important;
}

.android-webview .menu-toggle svg,
.ios-webview .menu-toggle svg {
    width: 24px;
    height: 24px;
    display: block;
}

/* 菜单打开状态 */
.header.menu-open .menu-toggle .menu-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.header.menu-open .menu-toggle .menu-line:nth-child(2) {
    opacity: 0;
    transform: translateX(-100%);
}

.header.menu-open .menu-toggle .menu-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* 设备特定优化 */
.android-device .menu-toggle,
.ios-device .menu-toggle {
    width: 24px;
    height: 18px;
    margin-right: 8px;
    margin-left: 10px;
}

.android-device .menu-line,
.ios-device .menu-line,
.android-device .menu-toggle svg,
.ios-device .menu-toggle svg {
    background-color: #333;
    height: 2px;
    width: 100%;
}

/* 确保菜单按钮在WebView中可见 */
.webview .menu-toggle {
    margin-left: 5px;
    display: flex !important;
}

/* 解决移动设备上的菜单样式问题 */
@media (max-width: 480px) {
    .header-title h1 {
        font-size: 18px;
        margin-left: 0px;
    }
    
    .menu-toggle {
        margin-right: 8px;
    }
}

/* 解决Safari的SVG渲染问题 */
@media not all and (min-resolution:.001dpcm) { 
    @supports (-webkit-appearance:none) {
        .menu-toggle svg {
            stroke: #333;
            display: block !important;
        }
    }
}
