/**
 * ProGames07 - Mobile Responsive Styles
 * Optimized for mobile devices with smooth 60fps performance
 */

/* ═══════════════════════════════════════════════════════════════════
   MOBILE OPTIMIZATIONS
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  /* Enable GPU acceleration */
  html {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-overflow-scrolling: touch;
  }

  body {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    overscroll-behavior-y: contain;
  }

  /* Optimize touch */
  * {
    touch-action: manipulation;
  }

  /* Simplify animations */
  * {
    animation-duration: 0.3s !important;
    transition-duration: 0.2s !important;
  }

  /* Disable heavy effects */
  .particles {
    display: none !important;
  }

  body::before {
    opacity: 0.5;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   TABLET (max-width: 900px)
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  .container {
    padding: 0 var(--spacing-md);
  }

  /* Header */
  .nav {
    display: none;
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    flex-direction: column;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    gap: var(--spacing-md);
    z-index: 999;
  }

  .nav.active {
    display: flex;
  }

  .mobile-only {
    display: flex;
  }

  /* Hero */
  .hero .container {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-content {
    order: 2;
  }

  .hero-visual {
    order: 1;
    height: 300px;
    margin-bottom: var(--spacing-lg);
  }

  .hero-description {
    max-width: 100%;
  }

  .hero-stats {
    justify-content: center;
  }

  /* Games Grid */
  .games-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
  }

  /* About */
  .about-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }

  /* Leaderboard */
  .leaderboard-tabs {
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .leaderboard-tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    flex-shrink: 0;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   MOBILE (max-width: 600px)
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 600px) {
  :root {
    --spacing-xs: 0.375rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
  }

  /* Header */
  .header .container {
    height: 64px;
  }

  .logo {
    font-size: 1.2rem;
  }

  .logo i {
    font-size: 1.5rem;
  }

  .icon-btn {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
  }

  /* Hero */
  .hero {
    padding: 100px 0 60px;
  }

  .hero-title {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .hero-subtitle {
    font-size: 1.1rem;
  }

  .hero-description {
    font-size: 0.95rem;
  }

  .hero-stats {
    flex-wrap: wrap;
    gap: var(--spacing-md);
  }

  .stat-value {
    font-size: 2rem;
  }

  .stat-label {
    font-size: 0.8rem;
  }

  .hero-visual {
    height: 250px;
  }

  /* Section */
  section {
    padding: 60px 0;
  }

  .section-title {
    font-size: clamp(1.5rem, 8vw, 2rem);
    margin-bottom: var(--spacing-lg);
  }

  /* Games Grid */
  .games-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .game-card {
    padding: var(--spacing-md);
  }

  .game-icon {
    font-size: 3rem;
  }

  .game-title {
    font-size: 1.3rem;
  }

  .game-description {
    font-size: 0.9rem;
  }

  /* Game Modal */
  .game-modal {
    padding: var(--spacing-sm);
  }

  .game-modal-content {
    max-height: 95vh;
  }

  .game-modal-header {
    padding: var(--spacing-sm) var(--spacing-md);
  }

  .game-modal-header h3 {
    font-size: 1.2rem;
  }

  .close-btn {
    width: 36px;
    height: 36px;
  }

  .game-modal-body {
    padding: var(--spacing-md);
    max-height: calc(95vh - 70px);
  }

  /* Leaderboard */
  .leaderboard-tabs {
    gap: var(--spacing-xs);
  }

  .tab-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }

  .leaderboard-content {
    padding: var(--spacing-md);
  }

  .leaderboard-item {
    padding: var(--spacing-sm);
    gap: var(--spacing-sm);
  }

  .leaderboard-rank {
    font-size: 1.2rem;
    min-width: 30px;
  }

  .leaderboard-score {
    font-size: 1rem;
  }

  /* About */
  .about-text h3 {
    font-size: 1.5rem;
  }

  .about-text p {
    font-size: 0.95rem;
  }

  .feature-list li {
    font-size: 0.95rem;
  }

  .feature-card {
    padding: var(--spacing-md);
  }

  .feature-card i {
    font-size: 2.5rem;
  }

  .feature-card h4 {
    font-size: 1.1rem;
  }

  .feature-card p {
    font-size: 0.9rem;
  }

  /* Footer */
  .footer {
    padding: var(--spacing-lg) 0;
  }

  .footer-brand {
    font-size: 1.2rem;
  }

  .footer-brand i {
    font-size: 1.5rem;
  }

  .footer p {
    font-size: 0.9rem;
  }

  /* Toast */
  #toast-container {
    bottom: var(--spacing-sm);
    right: var(--spacing-sm);
    left: var(--spacing-sm);
  }

  .toast {
    min-width: auto;
    width: 100%;
  }

  /* Buttons */
  .btn {
    padding: 0.65rem 1.25rem;
    font-size: 0.85rem;
  }

  .btn-large {
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   SMALL MOBILE (max-width: 400px)
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 400px) {
  .hero-title {
    font-size: 1.8rem;
  }

  .hero-stats {
    flex-direction: column;
    gap: var(--spacing-sm);
  }

  .stat {
    width: 100%;
  }

  .game-icon {
    font-size: 2.5rem;
  }

  .game-title {
    font-size: 1.2rem;
  }

  .section-title {
    font-size: 1.3rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   LANDSCAPE MOBILE
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 900px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: 100px 0 40px;
  }

  .hero .container {
    grid-template-columns: 1fr 1fr;
  }

  .hero-content {
    order: 1;
    text-align: left;
  }

  .hero-visual {
    order: 2;
    height: 300px;
    margin-bottom: 0;
  }

  .hero-stats {
    justify-content: flex-start;
  }

  .game-modal-content {
    max-height: 95vh;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   SAFE AREA INSETS (iPhone X+, Notch Support)
   ═══════════════════════════════════════════════════════════════════ */

@supports (padding: max(0px)) {
  @media (max-width: 900px) {
    body {
      padding-left: env(safe-area-inset-left);
      padding-right: env(safe-area-inset-right);
    }

    .header .container {
      padding-left: max(var(--spacing-md), env(safe-area-inset-left));
      padding-right: max(var(--spacing-md), env(safe-area-inset-right));
    }

    .footer {
      padding-bottom: max(var(--spacing-xl), env(safe-area-inset-bottom));
    }
  }
}

/* ═══════════════════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════════════════ */

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