/* ===== DEVICE-SPECIFIC OPTIMIZATIONS ===== */

/* MOBILE MODE */
body.device-mobile .game-container {
    padding: 0.75rem;
    gap: 0.75rem;
}

body.device-mobile .game-canvas-wrapper {
    aspect-ratio: 9 / 16;
    max-height: 70vh;
}

body.device-mobile .game-header h2 {
    font-size: 1.2rem;
}

body.device-mobile .game-controls {
    gap: 0.5rem;
}

body.device-mobile .game-controls .btn {
    min-width: 80px;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
}

body.device-mobile .mobile-controls {
    display: flex !important;
}

body.device-mobile .game-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
}

body.device-mobile .nav-links {
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    background: var(--bg-secondary);
    flex-direction: column;
    padding: 2rem;
    gap: 1.5rem;
    border-bottom: 1px solid var(--border);
    transform: translateY(-150%);
    transition: transform 0.3s;
}

body.device-mobile .nav-links.open {
    transform: translateY(0);
}

body.device-mobile .mobile-menu-btn {
    display: block;
}

body.device-mobile #main-content {
    padding: 0.75rem;
}

body.device-mobile .device-card {
    padding: 1.5rem 1rem !important;
}

body.device-mobile .device-card strong {
    font-size: 0.95rem !important;
}

body.device-mobile .device-card small {
    font-size: 0.75rem !important;
}

/* TABLET MODE */
body.device-tablet .game-container {
    padding: 1.25rem;
    gap: 1rem;
}

body.device-tablet .game-canvas-wrapper {
    aspect-ratio: 4 / 3;
    max-width: 700px;
}

body.device-tablet .game-header h2 {
    font-size: 1.5rem;
}

body.device-tablet .game-controls .btn {
    min-width: 100px;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
}

body.device-tablet .mobile-controls {
    display: flex !important;
}

body.device-tablet .game-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

body.device-tablet .device-card {
    padding: 1.75rem 1.25rem !important;
}

/* DESKTOP MODE */
body.device-desktop .game-container {
    padding: 2rem;
    gap: 1.5rem;
}

body.device-desktop .game-canvas-wrapper {
    aspect-ratio: 16 / 9;
    max-width: 900px;
}

body.device-desktop .game-header h2 {
    font-size: 1.8rem;
}

body.device-desktop .game-controls .btn {
    min-width: 120px;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
}

body.device-desktop .mobile-controls {
    display: none !important;
}

body.device-desktop .game-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

body.device-desktop .nav-links {
    display: flex !important;
    transform: none !important;
    position: static;
    background: transparent;
    border: none;
    padding: 0;
}

body.device-desktop .mobile-menu-btn {
    display: none !important;
}

/* ===== GENERAL RESPONSIVE FALLBACKS ===== */
@media (max-width: 768px) {
    .game-grid {
        grid-template-columns: 1fr !important;
    }
    
    .nav-links {
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        background: var(--bg-secondary);
        flex-direction: column;
        padding: 2rem;
        gap: 1.5rem;
        border-bottom: 1px solid var(--border);
        transform: translateY(-150%);
        transition: transform 0.3s;
    }
    
    .nav-links.open {
        transform: translateY(0);
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    #main-content {
        padding: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}