/* Mobile-specific optimizations */
/* ============================== */

/* Mobile video container fix */
@media (max-width: 768px) {
    /* Video containers */
    .video-container,
    .trailer-container {
        position: relative;
        width: 100%;
        padding-bottom: 56.25%; /* 16:9 aspect ratio */
        height: 0;
        overflow: hidden;
        border-radius: 12px;
    }
    
    .video-container iframe,
    .trailer-container iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border: none;
    }
    
    /* Adjust video preview height on mobile */
    .game-trailer {
        min-height: 250px;
    }
    
    /* Hero section mobile optimization */
    .hero {
        padding: 3rem 1rem;
        min-height: 70vh;
    }
    
    .hero-title {
        font-size: clamp(2rem, 8vw, 3rem);
        line-height: 1.1;
        margin-bottom: 1rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    /* Mobile navigation improvements */
    nav {
        padding: 1rem;
    }
    
    .nav-container {
        padding: 0;
    }
    
    .nav-menu {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(26, 29, 35, 0.98);
        flex-direction: column;
        justify-content: flex-start;
        padding: 2rem;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
    }
    
    .nav-menu.active {
        transform: translateX(0);
        display: flex;
    }
    
    .nav-menu li {
        width: 100%;
    }
    
    .nav-menu a {
        display: block;
        padding: 1rem;
        font-size: 1.1rem;
        border-radius: 8px;
        width: 100%;
    }
    
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        font-size: 1.5rem;
    }
    
    /* Language selector mobile */
    .language-selector {
        width: 100%;
        margin-top: 2rem;
        justify-content: center;
    }
    
    .lang-btn {
        flex: 1;
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
    
    /* 改进的移动端网格布局 */
    .games-grid,
    .features-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }
    
    .content-grid.two-col,
    .content-grid.three-col,
    .content-grid.four-col {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }
    
    /* 渐进式增强 - 中等屏幕 */
    @media (min-width: 600px) {
        .content-grid.three-col,
        .content-grid.four-col {
            grid-template-columns: repeat(2, 1fr);
        }
    }
    
    .card {
        padding: 1.25rem;
    }
    
    /* 改进的移动端字体系统 */
    p {
        font-size: clamp(1rem, 2.5vw, 1.1rem);
        line-height: 1.75;
        margin-bottom: var(--spacing-lg);
    }
    
    .game-description {
        font-size: clamp(0.95rem, 2.2vw, 1.05rem);
        line-height: 1.7;
    }
    
    /* 移动端标题优化 */
    h1 {
        font-size: clamp(1.75rem, 6vw, 2.5rem);
        line-height: 1.15;
        margin-bottom: var(--spacing-lg);
    }
    
    h2 {
        font-size: clamp(1.5rem, 5vw, 2rem);
        line-height: 1.25;
        margin-bottom: var(--spacing-md);
    }
    
    h3 {
        font-size: clamp(1.25rem, 4vw, 1.75rem);
        line-height: 1.3;
        margin-bottom: var(--spacing-md);
    }
    
    /* Button sizes for mobile */
    .btn {
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
        width: 100%;
        min-height: 48px; /* Minimum touch target size */
    }
    
    .platform-btn {
        min-height: 80px;
    }
    
    /* Info cards mobile layout */
    .info-section {
        padding: 1rem;
    }
    
    .info-card {
        padding: 1.25rem;
        margin-bottom: 1.5rem;
    }
    
    /* Tags mobile optimization */
    .tags-container {
        justify-content: flex-start;
    }
    
    .tag {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    /* Footer mobile */
    footer {
        padding: 2rem 1rem;
        text-align: center;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 2rem;
    }
    
    /* Modal and overlay adjustments */
    .modal {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }
    
    /* Performance optimizations */
    .animate-on-scroll {
        animation-duration: 0.5s; /* Faster animations on mobile */
    }
    
    /* Reduce shadows on mobile for performance */
    .card:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    /* Touch-friendly spacing */
    a, button {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Improve readability on small screens */
    .section-title {
        font-size: 1.75rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }
}

/* Tablet specific adjustments */
@media (min-width: 481px) and (max-width: 768px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .container {
        padding: 0 2rem;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .hero-title {
        font-size: 1.75rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .nav-container {
        gap: 1rem;
    }
    
    .logo {
        font-size: 1.2rem;
    }

    /* Stack platform buttons vertically on very small screens */
    .platform-buttons {
        flex-direction: column;
    }
    
    .platform-btn {
        width: 100%;
    }
}

/* Landscape mobile optimization */
@media (max-height: 600px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 2rem 1rem;
    }
    
    .nav-menu {
        top: 50px;
        padding: 1rem;
    }
    
    .video-container {
        padding-bottom: 40%;
    }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Use higher quality images for retina displays */
    .game-icon img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Dark mode optimizations */
@media (prefers-color-scheme: dark) {
    :root {
        --glass-bg: rgba(255, 255, 255, 0.03);
        --glass-border: rgba(255, 255, 255, 0.08);
    }
}

/* 改进的响应式断点系统 */

/* 超小屏幕优化 (320px - 480px) */
@media (max-width: 480px) {
    :root {
        --element-spacing: var(--spacing-md);
        --section-spacing: var(--spacing-xl);
    }
    
    .container {
        padding: 0 var(--spacing-md);
    }
}

/* 中小屏幕优化 (481px - 640px) */
@media (min-width: 481px) and (max-width: 640px) {
    .content-grid.four-col {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 平板屏幕优化 (641px - 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
    .content-grid.two-col {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .content-grid.three-col {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .content-grid.four-col {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 大屏幕优化 (1025px+) */
@media (min-width: 1025px) {
    .content-grid.four-col {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Print styles for mobile */
@media print {
    .mobile-menu-toggle,
    .nav-menu,
    .language-selector {
        display: none !important;
    }
}