/* Mobile Responsive Design */

/* Extra small devices (phones, 480px and down) */
@media (max-width: 480px) {
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.45rem; /* 减小卡片间距，增加每列可用宽度 */
    }
    .game-card { margin: 0; min-height: auto; }
    .game-thumbnail-container { height: 110px; }
    .game-info { padding: 0.55rem 0.6rem 0.7rem 0.6rem; } /* 缩小左右内边距 */
    .game-title {
        font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; /* 更紧凑字体 */
        font-weight: 700;
        letter-spacing: -0.2px; /* 轻微压缩字距 */
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
        height: 2.4em;
        margin-bottom: 0.2rem;
    }
    .game-description { font-size: 0.78rem; white-space: nowrap; margin-bottom: 0; height: 1.2em; }
    .game-play-btn { font-size: 0.8rem; padding: 0.6rem; }
}

/* Small devices (phones, 576px and down) */
@media (max-width: 576px) {
    .nav-container {
        padding: 0 1rem;
    }
    
    .nav-menu {
        position: fixed;
        top: 70px;
        right: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: rgba(0, 0, 0, 0.95);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding-top: 2rem;
        transition: right 0.3s ease;
        backdrop-filter: blur(20px);
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .nav-menu .nav-link {
        font-size: 1.2rem;
        margin: 1rem 0;
    }
    
    /* Mobile dropdown menu */
    .nav-dropdown {
        width: 100%;
    }
    
    .nav-dropdown > .nav-link {
        display: block;
        width: 100%;
        text-align: center;
        margin: 1rem 0; /* 与其他导航链接保持一致的间隔 */
    }
    
    .nav-dropdown > .nav-link::after {
        display: none; /* 移除More的下划线效果 */
    }
    
    .nav-dropdown-content {
        position: static;
        display: none;
        background: transparent;
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 0;
        margin: 0;
        border-top: none !important; /* 移除顶部边框 */
    }
    
    .nav-dropdown-content a {
        padding: 0;
        font-size: 1.2rem; /* 与其他导航链接字体大小一致 */
        text-align: center;
        border: none !important;
        margin: 1rem 0; /* 与其他导航链接保持一致的间隔 */
        display: block;
        color: #d1d5db; /* 与其他导航链接颜色一致 */
    }
    
    .nav-dropdown-content a:hover {
        padding-left: 0; /* 悬停时不改变左边距 */
        background: transparent;
        color: #dc2626; /* 悬停时变红 */
    }
    
    .nav-dropdown.active .nav-dropdown-content {
        display: block;
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .nav-controls {
        display: none;
    }
    
    .hero-container {
        height: 60vh;
        min-height: 400px;
    }
    
    .hero-title {
        font-size: 1.2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        padding: 0 1rem;
    }
    
    .btn-large {
        padding: 14px 28px;
        font-size: 1rem;
    }
    
    .game-modules {
        grid-template-columns: 1fr;
        padding: 0 1rem;
        gap: 1.5rem;
        margin: 1.5rem auto;
    }
    
    .blog-preview-image {
        height: 180px;
    }
    
    .blog-preview-title {
        font-size: 1.25rem;
    }
    
    .blog-preview-snippet {
        font-size: 0.9rem;
        line-height: 1.6;
        min-height: calc(0.9rem * 1.6 * 2);
        max-height: calc(0.9rem * 1.6 * 2);
    }
    
    .related-games-section {
        margin: 1.5rem auto;
        padding: 0 1rem;
    }
    
    .module-card {
        padding: 1.5rem;
    }
    
    .game-area {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .game-canvas {
        height: 300px;
    }
    
    .game-ui {
        padding: 1rem;
    }
    
    .timeline-item {
        padding-left: 60px;
    }
    
    .timeline-marker {
        left: 15px;
        width: 15px;
        height: 15px;
    }
    
    .activity-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .activity-card {
        padding: 1.5rem;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 1rem;
    }
    
    /* Games section mobile */
    .games-grid { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
    .game-card { margin: 0; min-height: auto; }
    .game-thumbnail-container { height: 110px; }
    .game-info { padding: 0.6rem 0.7rem 0.8rem 0.7rem; }
    .game-title {
        font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        font-weight: 700;
        letter-spacing: -0.2px;
        font-size: 0.84rem;
        height: 2.4em;
        -webkit-line-clamp: 2;
        margin-bottom: 0.2rem;
    }
    .game-description { font-size: 0.8rem; white-space: nowrap; margin-bottom: 0; height: 1.2em; }
    
    .game-detail-header {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .game-iframe {
        height: 400px;
    }
    
    /* Fullscreen button mobile */
    .fullscreen-toggle {
        width: 36px;
        height: 36px;
        top: 8px;
        right: 8px;
    }
    
    .fullscreen-toggle svg {
        width: 20px;
        height: 20px;
    }
    
    .game-actions {
        flex-direction: column;
    }
}

/* Medium devices (tablets, 768px and down) */
@media (max-width: 768px) {
    .hero-container {
        height: 65vh;
        min-height: 450px;
    }
    
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    .hero-title {
        font-size: 1.4rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .game-modules {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        padding: 0 1rem;
    }
    
    .game-area {
        grid-template-columns: 1fr;
    }
    
    .game-canvas {
        height: 400px;
    }
    
    .activity-grid {
        grid-template-columns: 1fr;
    }
    
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .game-detail-header {
        grid-template-columns: 1fr;
    }
    
    .game-iframe {
        height: 500px;
    }
    
    .timeline::before {
        left: 25px;
    }
    
    .timeline-item {
        padding-left: 70px;
    }
    
    .timeline-marker {
        left: 18px;
        width: 18px;
        height: 18px;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .nav-menu {
        gap: 3rem;
    }
    
    .hero-title {
        font-size: 1.6rem;
    }
    
    .games-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
    
    .game-modules {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
        padding: 0 2rem;
    }
    
    .game-area {
        grid-template-columns: 1fr 350px;
    }
    
    .game-canvas {
        height: 600px;
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .nav-container {
        padding: 0 2rem;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
    
    .game-modules {
        grid-template-columns: repeat(2, 1fr);
        max-width: 1400px;
    }
    
    .game-area {
        grid-template-columns: 1fr 400px;
    }
    
    .game-canvas {
        height: 700px;
    }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    .hero-container {
        height: 100vh;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    .btn-large {
        padding: 12px 24px;
        font-size: 0.9rem;
    }
    
    .game-canvas {
        height: 250px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo-text {
        text-shadow: 0 0 15px rgba(220, 38, 38, 0.4);
    }
    
    .hero-title {
        text-shadow: 0 0 40px rgba(220, 38, 38, 0.6);
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .heartbeat,
    .flicker,
    .pulse,
    .float,
    .glow {
        animation: none;
    }
    
    .fog-overlay {
        animation: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: #000000;
        color: #ffffff;
    }
}

/* Blog Responsive Styles */
@media (max-width: 576px) {
    .blog-main-title {
        font-size: 2rem;
    }
    
    .blog-subtitle {
        font-size: 0.95rem;
        line-height: 1.5;
        padding: 0 1rem;
    }
    
    .blog-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .blog-sidebar {
        position: static;
        order: -1;
    }
    
    .article-card {
        grid-template-columns: 1fr;
    }
    
    .article-thumbnail-container {
        width: 100%;
        height: 180px;
    }
    
    .article-content {
        padding: 1rem 1.5rem;
    }
    
    .article-title {
        font-size: 1.2rem;
    }
    
    .article-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .blog-pagination {
        gap: 1rem;
    }
    
    .pagination-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    .sidebar-section {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .blog-main-title {
        font-size: 2.5rem;
    }
    
    .blog-layout {
        grid-template-columns: 1fr;
    }
    
    .blog-sidebar {
        position: static;
    }
    
    .article-card {
        grid-template-columns: 1fr; /* 改为纵向布局：图片在上，文字在下 */
    }
    
    .article-thumbnail-container {
        width: 100%; /* 图片占满宽度 */
        height: 200px;
    }
    
    .article-content {
        padding: 1.5rem;
    }
}

@media (max-width: 1024px) {
    .blog-layout {
        grid-template-columns: 1fr;
    }
    
    .blog-sidebar {
        position: static;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        display: grid;
    }
}

/* Article Detail Responsive */
/* Large screens (desktops, 1200px and up) */
@media (min-width: 1200px) {
    .article-detail {
        width: 85%;
        max-width: 1400px;
    }
}

/* Medium screens (tablets, 768px to 1199px) */
@media (max-width: 1199px) {
    .article-detail {
        width: 92%;
        max-width: 100%;
    }
}

/* Small screens (phones, 767px and down) */
@media (max-width: 767px) {
    .article-detail {
        width: 95%;
        padding: 1rem !important;
    }
    
    .article-detail-title {
        font-size: 1.8rem !important;
    }
    
    .article-detail-body {
        font-size: 1rem;
    }
    
    .article-detail-body h2 {
        font-size: 1.5rem;
    }
    
    .article-detail-body h3 {
        font-size: 1.25rem;
    }
}

/* Extra small screens (phones, 480px and down) */
@media (max-width: 480px) {
    .article-detail {
        width: 100%;
        padding: 0.5rem !important;
    }
    
    .article-detail-title {
        font-size: 1.5rem !important;
    }
}

/* Print styles */
@media print {
    .navbar,
    .nav-controls,
    .hero-atmosphere,
    .fog-overlay,
    .blog-sidebar,
    .blog-search-container,
    .blog-pagination {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .section {
        display: block !important;
        page-break-inside: avoid;
    }
    
    .article-card {
        page-break-inside: avoid;
        border: 1px solid #ccc;
    }
}
