/* Mobile Responsive Optimization CSS */
/* Drop The Cat Game Guide - Mobile First Design */

/* ===== MOBILE FONT AND SPACING OPTIMIZATION ===== */
@media screen and (max-width: 768px) {
    /* 基础字体大小调整 */
    html {
        font-size: 14px; /* 从默认16px减小到14px */
    }
    
    body {
        font-size: 14px;
        line-height: 1.5;
        padding: 0;
        margin: 0;
    }
    
    /* 标题字体大小优化 */
    h1 {
        font-size: 1.75rem !important; /* 28px */
        line-height: 1.3;
        margin-bottom: 0.75rem;
    }
    
    h2 {
        font-size: 1.5rem !important; /* 24px */
        line-height: 1.3;
        margin-bottom: 0.75rem;
    }
    
    h3 {
        font-size: 1.25rem !important; /* 20px */
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }
    
    h4 {
        font-size: 1.125rem !important; /* 18px */
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }
    
    /* 段落和文本优化 */
    p {
        font-size: 0.875rem; /* 14px */
        line-height: 1.5;
        margin-bottom: 0.75rem;
    }
    
    /* 导航栏优化 */
    nav {
        padding: 0.5rem 0;
    }
    
    .nav-link {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* 搜索框优化 */
    input[type="number"], input[type="text"] {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    button {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
}

/* ===== MOBILE GRID LAYOUT OPTIMIZATION ===== */
@media screen and (max-width: 768px) {
    /* 首页图文列表 - 两列布局 */
    #featured-levels {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    
    /* 列表页图文列表 - 两列布局 */
    #levels-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    
    /* 详情页图文列表 - 两列布局 */
    .level-card {
        margin-bottom: 0.75rem;
    }
    
    /* 卡片内容优化 */
    .level-card .level-text-content {
        padding: 0.75rem !important;
    }
    
    .level-card .level-title {
        font-size: 0.875rem !important;
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }
    
    .level-card .level-badge {
        font-size: 0.75rem !important;
        padding: 0.25rem 0.5rem !important;
        top: 0.5rem !important;
        right: 0.5rem !important;
    }
    
    /* 卡片图片高度调整 */
    .level-card .bg-gray-100 {
        height: 120px !important;
    }
}

/* ===== MOBILE SPACING AND PADDING OPTIMIZATION ===== */
@media screen and (max-width: 768px) {
    /* 容器间距优化 */
    .container, .max-w-6xl, .max-w-7xl {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* 区块间距优化 */
    section {
        padding: 2rem 0 !important;
    }
    
    /* Hero区域优化 */
    .hero-section {
        padding: 1.5rem 0 !important;
    }
    
    .hero-section h1 {
        font-size: 1.75rem !important;
        margin-bottom: 0.75rem;
    }
    
    .hero-section p {
        font-size: 0.875rem;
        margin-bottom: 1rem;
    }
    
    /* 统计信息优化 */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    
    .stat-item {
        text-align: center;
        padding: 0.5rem;
    }
    
    .stat-number {
        font-size: 1.25rem !important;
    }
    
    .stat-label {
        font-size: 0.75rem !important;
    }
}

/* ===== MOBILE NAVIGATION OPTIMIZATION ===== */
@media screen and (max-width: 768px) {
    /* 导航栏高度优化 */
    nav .flex {
        height: 3.5rem !important;
    }
    
    /* Logo优化 */
    nav .text-xl {
        font-size: 1rem !important;
    }
    
    /* 移动端菜单优化 */
    .mobile-menu {
        padding: 0.5rem 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-in-out;
    }
    
    .mobile-menu.active {
        max-height: 500px;
    }
    
    .mobile-menu a {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    /* 移动端菜单按钮动画 */
    #mobile-menu-button {
        transition: transform 0.3s ease;
    }
    
    #mobile-menu-button.active {
        transform: rotate(90deg);
    }
    
    /* 搜索框优化 */
    #navLevelJump, #mobileNavLevelJump {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
}

/* ===== MOBILE BUTTON AND INTERACTION OPTIMIZATION ===== */
@media screen and (max-width: 768px) {
    /* 按钮尺寸优化 */
    .btn-primary, .btn-secondary {
        padding: 0.75rem 1.5rem !important;
        font-size: 0.875rem !important;
        border-radius: 0.5rem !important;
    }
    
    /* 下载按钮优化 */
    .download-btn {
        padding: 0.75rem 1rem !important;
        font-size: 0.875rem !important;
    }
    
    /* 标签页按钮优化 */
    .level-tab-btn {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.75rem !important;
        margin-bottom: 0.5rem;
    }
    
    /* 应用徽章优化 */
    .app-badge {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.75rem !important;
    }
}

/* ===== MOBILE GAME CONTAINER OPTIMIZATION ===== */
@media screen and (max-width: 768px) {
    /* 游戏容器优化 */
    .game-container {
        margin: 1rem 0;
    }
    
    .game-iframe {
        height: 300px !important;
        border-radius: 0.5rem;
    }
    
    /* 游戏描述优化 */
    .prose {
        font-size: 0.875rem;
    }
    
    .prose h3 {
        font-size: 1.125rem !important;
        margin-bottom: 0.75rem;
    }
    
    .prose h4 {
        font-size: 1rem !important;
        margin-bottom: 0.5rem;
    }
    
    .prose p, .prose li {
        font-size: 0.875rem;
        line-height: 1.5;
    }
}

/* ===== MOBILE FAQ AND CONTENT OPTIMIZATION ===== */
@media screen and (max-width: 768px) {
    /* FAQ优化 */
    .faq-item {
        margin-bottom: 0.75rem;
    }
    
    .faq-item button {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .faq-item .content {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    /* 功能特性优化 */
    .feature-item {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .feature-item h3 {
        font-size: 1rem !important;
        margin-bottom: 0.5rem;
    }
    
    .feature-item p {
        font-size: 0.875rem;
    }
}

/* ===== MOBILE VIDEO AND MEDIA OPTIMIZATION ===== */
@media screen and (max-width: 768px) {
    /* 视频容器优化 */
    .video-info-header {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .video-info-header h3 {
        font-size: 1rem !important;
    }
    
    .video-duration-display {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* 分享按钮优化 */
    .share-buttons {
        gap: 0.5rem;
    }
    
    .share-buttons a, .share-buttons button {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
}

/* ===== MOBILE PAGINATION OPTIMIZATION ===== */
@media screen and (max-width: 768px) {
    /* 分页优化 */
    .pagination {
        gap: 0.25rem;
    }
    
    .pagination a, .pagination span {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    /* 分页信息优化 */
    .pagination-info {
        font-size: 0.75rem;
        margin-top: 0.5rem;
    }
}

/* ===== MOBILE LEVEL RANGES OPTIMIZATION ===== */
@media screen and (max-width: 768px) {
    /* 关卡范围按钮优化 */
    .level-ranges-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.5rem;
    }
    
    .level-range-link {
        padding: 0.75rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* ===== MOBILE HERO SEARCH OPTIMIZATION ===== */
@media screen and (max-width: 768px) {
    /* Hero搜索框优化 */
    .hero-search-container {
        padding: 0 1rem;
    }
    
    .hero-search-box {
        border-radius: 1rem;
        padding: 0.5rem;
    }
    
    .hero-search-input {
        font-size: 1rem;
        padding: 0.75rem 0.5rem;
    }
    
    .hero-search-btn {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1rem;
    }
    
    .hero-search-hint {
        font-size: 0.875rem;
        margin-top: 0.75rem;
    }
}

/* ===== MOBILE CUBE CAROUSEL OPTIMIZATION ===== */
@media screen and (max-width: 768px) {
    /* 3D立方体在移动端隐藏或简化 */
    .cube-scene {
        display: none;
    }
    
    /* 或者显示简化版本 */
    .cube-scene.mobile-simplified {
        display: block;
        height: 200px;
    }
    
    .cube-scene.mobile-simplified .cube {
        transform: scale(0.7);
    }
}

/* ===== MOBILE UTILITY CLASSES ===== */
@media screen and (max-width: 768px) {
    /* 移动端专用工具类 */
    .mobile-hidden {
        display: none !important;
    }
    
    .mobile-visible {
        display: block !important;
    }
    
    .mobile-text-sm {
        font-size: 0.875rem !important;
    }
    
    .mobile-text-xs {
        font-size: 0.75rem !important;
    }
    
    .mobile-p-2 {
        padding: 0.5rem !important;
    }
    
    .mobile-p-3 {
        padding: 0.75rem !important;
    }
    
    .mobile-mb-2 {
        margin-bottom: 0.5rem !important;
    }
    
    .mobile-mb-3 {
        margin-bottom: 0.75rem !important;
    }
    
    .mobile-gap-2 {
        gap: 0.5rem !important;
    }
    
    .mobile-gap-3 {
        gap: 0.75rem !important;
    }
}

/* ===== MOBILE PERFORMANCE OPTIMIZATION ===== */
@media screen and (max-width: 768px) {
    /* 减少动画以提高性能 */
    * {
        animation-duration: 0.2s !important;
        transition-duration: 0.2s !important;
    }
    
    /* 简化阴影效果 */
    .card, .level-card {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    }
    
    .card:hover, .level-card:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
        transform: translateY(-2px) !important;
    }
    
    /* 简化渐变效果 */
    .gradient-bg {
        background: #f8fafc !important;
    }
    
    /* 优化图片渲染 */
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: optimize-contrast;
    }
}

/* ===== MOBILE LANDSCAPE ORIENTATION ===== */
@media screen and (orientation: landscape) and (max-height: 500px) {
    /* 横屏模式优化 */
    .hero-section {
        padding: 1rem 0 !important;
    }
    
    .hero-section h1 {
        font-size: 1.5rem !important;
    }
    
    section {
        padding: 1rem 0 !important;
    }
    
    /* 导航栏在横屏时更紧凑 */
    nav .flex {
        height: 3rem !important;
    }
}

/* ===== MOBILE VERY SMALL SCREENS ===== */
@media screen and (max-width: 320px) {
    /* 超小屏幕优化 */
    html {
        font-size: 13px;
    }
    
    .container, .max-w-6xl, .max-w-7xl {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    #featured-levels, #levels-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }
    
    .level-card .bg-gray-100 {
        height: 100px !important;
    }
    
    .level-card .level-text-content {
        padding: 0.5rem !important;
    }
    
    .level-card .level-title {
        font-size: 0.75rem !important;
    }
    
    .level-card .level-badge {
        font-size: 0.625rem !important;
        padding: 0.125rem 0.375rem !important;
    }
}

/* ===== MOBILE ACCESSIBILITY ===== */
@media screen and (max-width: 768px) {
    /* 触摸友好的按钮尺寸 */
    button, .btn, a[role="button"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* 增加触摸目标大小 */
    .level-card, .level-range-link {
        min-height: 44px;
    }
    
    /* 优化焦点状态 */
    button:focus, input:focus, a:focus {
        outline: 2px solid #3b82f6;
        outline-offset: 2px;
    }
}

/* ===== MOBILE DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    .level-card {
        background: #1f2937 !important;
        border-color: #374151 !important;
    }
    
    .level-card:hover {
        background: #374151 !important;
    }
    
    .level-title {
        color: #f9fafb !important;
    }
    
    .level-badge {
        background: #3b82f6 !important;
    }
}

/* ===== MOBILE TOUCH FEEDBACK ===== */
.touch-active {
    transform: scale(0.98) !important;
    opacity: 0.8 !important;
    transition: all 0.1s ease !important;
}

/* ===== MOBILE PERFORMANCE TIP ===== */
.performance-tip {
    position: fixed;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #f59e0b;
    border-radius: 0.75rem;
    padding: 0.75rem;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    animation: slideInDown 0.3s ease;
}

.tip-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #92400e;
}

.tip-close {
    background: none;
    border: none;
    color: #92400e;
    font-size: 1.25rem;
    cursor: pointer;
    margin-left: auto;
    padding: 0;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== MOBILE NETWORK ERROR ===== */
.network-error {
    position: fixed;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border: 1px solid #ef4444;
    border-radius: 0.75rem;
    padding: 0.75rem;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    animation: slideInDown 0.3s ease;
}

.error-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #dc2626;
}

.error-retry {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 0.375rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    cursor: pointer;
    margin-left: auto;
}

/* ===== MOBILE ANIMATIONS ===== */
@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeIn 0.5s ease forwards;
}

/* ===== MOBILE FOCUS STATES ===== */
.focused {
    transform: scale(1.02);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.valid {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* ===== MOBILE SCROLLED STATE ===== */
.scrolled nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

/* ===== MOBILE DEVICE INDICATOR ===== */
.mobile-device {
    /* 移动端设备标识 */
}

.mobile-device .desktop-only {
    display: none !important;
}

.mobile-device .mobile-only {
    display: block !important;
}

/* ===== MOBILE LAZY LOADING ===== */
.lazy {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.loaded {
    opacity: 1;
}

.image-placeholder {
    display: none;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    color: #6b7280;
    font-size: 0.875rem;
}

/* ===== MOBILE RESPONSIVE GRID FALLBACKS ===== */
@media screen and (max-width: 768px) {
    /* 确保网格布局在移动端正确显示 */
    .grid {
        display: grid;
    }
    
    .grid-cols-1 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
    
    .grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    
    .grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    
    .grid-cols-5 {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
    
    /* 移动端网格间距 */
    .gap-1 {
        gap: 0.25rem;
    }
    
    .gap-2 {
        gap: 0.5rem;
    }
    
    .gap-3 {
        gap: 0.75rem;
    }
    
    .gap-4 {
        gap: 1rem;
    }
    
    .gap-6 {
        gap: 1.5rem;
    }
}
