/* 移动端优化样式 */
@media (max-width: 768px) {
    /* 搜索框在移动端的优化 */
    .relative input[type="text"] {
        width: 200px;
        font-size: 14px;
    }
    
    /* 主标题在移动端的调整 */
    .text-5xl {
        font-size: 2.5rem;
        line-height: 1.2;
    }
    
    /* 卡片网格在移动端的调整 */
    .grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    /* 排行榜在移动端的优化 */
    .lg\\:grid-cols-3 {
        grid-template-columns: repeat(1, 1fr);
        gap: 1rem;
    }
    
    /* 底部导航在移动端的优化 */
    .md\\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    /* 移动端菜单样式 */
    #mobile-menu {
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(10px);
    }
    
    /* 搜索建议在移动端的优化 */
    #search-suggestions {
        font-size: 14px;
        max-height: 200px;
    }
    
    /* 模态框在移动端的优化 */
    .fixed.inset-0 .bg-gray-900 {
        margin: 1rem;
        max-width: none;
    }
    
    /* 吐司通知在移动端的优化 */
    .fixed.top-4.right-4 {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        transform: translateY(-100%);
    }
    
    .fixed.top-4.right-4.transform {
        transform: translateY(0);
    }
}

@media (max-width: 640px) {
    /* 超小屏幕优化 */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* 主标题进一步调整 */
    .text-5xl {
        font-size: 2rem;
    }
    
    /* 按钮在小屏幕上的调整 */
    .flex-col.sm\\:flex-row {
        flex-direction: column;
    }
    
    /* 搜索框在小屏幕上隐藏 */
    .relative input[type="text"] {
        display: none;
    }
    
    /* 卡片标题调整 */
    .font-bold.text-lg {
        font-size: 0.9rem;
    }
    
    /* 排行榜项目在小屏幕上的调整 */
    .flex.items-center.space-x-4 {
        padding: 0.5rem;
    }
    
    /* 底部版权信息的调整 */
    .text-center.text-sm {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
}

/* 横屏模式优化 */
@media (orientation: landscape) and (max-height: 500px) {
    /* 主横幅区域高度调整 */
    .h-screen {
        height: 100vh;
        min-height: 400px;
    }
    
    /* 主标题在横屏模式下的调整 */
    .text-5xl {
        font-size: 2rem;
    }
    
    /* 导航栏在横屏模式下的调整 */
    .sticky.top-0 {
        position: fixed;
        background: rgba(0, 0, 0, 0.9);
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 移除悬停效果，改为点击效果 */
    .hover\\:text-red-400:hover {
        color: inherit;
    }
    
    .hover\\:bg-gray-700:hover {
        background-color: inherit;
    }
    
    /* 增大点击区域 */
    .cursor-pointer {
        min-height: 44px;
        padding: 0.5rem;
    }
    
    /* 搜索按钮优化 */
    .absolute.right-2 {
        right: 0.5rem;
        padding: 0.5rem;
    }
}

/* 深色模式优化 */
@media (prefers-color-scheme: dark) {
    /* 确保在深色模式下的显示效果 */
    body {
        background-color: #111827;
        color: #ffffff;
    }
    
    /* 搜索框在深色模式下的优化 */
    input[type="text"] {
        background-color: #374151;
        border-color: #4B5563;
    }
    
    /* 卡片在深色模式下的优化 */
    .bg-gray-900 {
        background-color: #1F2937;
    }
    
    .bg-gray-800 {
        background-color: #374151;
    }
}

/* 减少动画的用户偏好设置 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 高对比度模式优化 */
@media (prefers-contrast: high) {
    .text-gray-300 {
        color: #ffffff;
    }
    
    .text-gray-400 {
        color: #e5e7eb;
    }
    
    .border-gray-600 {
        border-color: #ffffff;
    }
}

/* 打印样式 */
@media print {
    /* 隐藏不必要的元素 */
    header, footer, .fixed, .sticky {
        display: none !important;
    }
    
    /* 打印时的背景色调整 */
    .bg-gray-900, .bg-gray-800 {
        background-color: #ffffff !important;
        color: #000000 !important;
    }
    
    /* 打印时的字体调整 */
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
}

/* 焦点可访问性优化 */
:focus-visible {
    outline: 2px solid #ef4444;
    outline-offset: 2px;
}

/* 跳过链接 */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

/* 屏幕阅读器优化 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 加载状态优化 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* 错误状态优化 */
.error {
    border-color: #ef4444;
    background-color: #fef2f2;
}

/* 成功状态优化 */
.success {
    border-color: #10b981;
    background-color: #f0fdf4;
}

/* 性能优化 */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* 滚动优化 */
.scroll-smooth {
    scroll-behavior: smooth;
}

/* 防止文本选择 */
.select-none {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 移动端安全区域适配 */
@supports (padding: max(0px)) {
    .safe-area-inset {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* iOS Safari 优化 */
@supports (-webkit-touch-callout: none) {
    .ios-fix {
        -webkit-overflow-scrolling: touch;
    }
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #374151;
}

::-webkit-scrollbar-thumb {
    background: #6b7280;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
} 