/* Mobile-Optimized Styles */
@media (max-width: 820px), (pointer: coarse) {
  body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #000;
    touch-action: pan-x pan-y;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  #app {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #010b12;
  }

  canvas {
    max-width: 100vw !important;
    max-height: 100vh !important;
    width: 100vw !important;
    height: 100vh !important;
    display: block !important;
    touch-action: none;
    object-fit: contain;
  }

  /* Hide mobile comic buttons */
  .mobile-adventure-root,
  .mobile-chapter-card,
  .mobile-saga-view,
  .mobile-map-view {
    display: none !important;
  }

  /* Optimize touch targets */
  button,
  a,
  [role='button'] {
    min-width: 44px;
    min-height: 44px;
  }

  /* Prevent text selection during gameplay */
  * {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
  }

  /* Improve text readability on mobile */
  body,
  canvas {
    font-size: 14px;
    line-height: 1.4;
  }

  /* Ensure full viewport usage */
  html,
  body,
  #app {
    width: 100%;
    height: 100%;
    position: fixed;
    overflow: hidden;
  }

  /* iOS Safari specific fixes */
  @supports (-webkit-touch-callout: none) {
    body {
      height: -webkit-fill-available;
    }

    #app {
      height: -webkit-fill-available;
    }
  }

  /* Landscape mode optimizations */
  @media (orientation: landscape) {
    canvas {
      width: 100vw !important;
      height: 100vh !important;
    }
  }

  /* Portrait mode optimizations */
  @media (orientation: portrait) {
    canvas {
      width: 100vw !important;
      height: auto !important;
      max-height: 100vh !important;
    }
  }
}

/* Desktop styles - ensure mobile styles don't leak */
@media (min-width: 821px) and (pointer: fine) {
  .mobile-only {
    display: none !important;
  }
}

/* Theme toggle for mobile */
@media (max-width: 820px), (pointer: coarse) {
  .mobile-theme-toggle {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(125, 253, 255, 0.2);
    border: 2px solid #7dfdff;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-theme-toggle:active {
    transform: scale(0.9);
    background: rgba(255, 87, 246, 0.3);
    border-color: #ff57f6;
  }

  .mobile-info {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #7dfdff;
    border-radius: 20px;
    padding: 8px 16px;
    backdrop-filter: blur(10px);
    z-index: 9999;
    pointer-events: none;
  }

  .mobile-info-text {
    color: #7dfdff;
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    text-align: center;
    line-height: 1.3;
  }

  .mobile-info-text small {
    color: #ff57f6;
    font-size: 9px;
  }
}
