/* ==========================================================================
   RESPONSIVE LAYOUT & DEVICE ADAPTATIONS
   Smartphone, Tablet, Desktop, Landscape & Portrait
   ========================================================================== */

/* Safe Area Insets for modern bezel-less phones */
#app {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Tablet & Smaller Desktop */
@media (max-width: 1024px) {
  .home-title {
    font-size: 2.8rem;
  }
  
  .game-play-area {
    max-width: 800px;
  }
  
  .fruit-item {
    font-size: 3.6rem;
  }
}

/* Smartphone Portrait */
@media (max-width: 600px) {
  .top-bar {
    padding: 8px 12px;
  }

  .hud-pill {
    padding: 4px 10px;
    font-size: 1rem;
    border-width: 2px;
  }

  .pill-icon {
    font-size: 1.3rem;
  }

  .btn-circle {
    width: 44px;
    height: 44px;
    min-height: 44px;
    font-size: 1.25rem;
  }

  .home-title {
    font-size: 2.1rem;
  }

  .game-logo-large {
    font-size: 2.4rem;
  }

  .home-momo-stage {
    transform: scale(0.9);
    margin: 5px 0;
  }

  .speech-bubble-momo {
    font-size: 0.95rem;
    padding: 6px 12px;
    right: -20px;
    top: -15px;
  }

  .btn-game {
    font-size: 1.15rem;
    padding: 12px 20px;
    min-height: 48px;
  }

  .btn-large-play {
    font-size: 1.35rem;
    padding: 15px 24px;
  }

  .game-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .game-card {
    padding: 14px 10px;
  }

  .card-icon-wrapper {
    width: 65px;
    height: 65px;
    font-size: 2.2rem;
  }

  .card-title {
    font-size: 1.1rem;
  }

  .card-subtitle {
    display: none;
  }

  /* Mini Games on Mobile */
  .game-instruction-banner {
    padding: 6px 14px;
    margin-bottom: 8px;
  }

  .instruction-text {
    font-size: 1.15rem;
  }

  .btn-speak-instruction {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }

  /* Game 1 */
  .fruit-item {
    font-size: 2.8rem;
  }

  .btn-number-option {
    height: 70px;
    font-size: 2rem;
  }

  /* Game 2 */
  .letter-hero-badge {
    width: 80px;
    height: 80px;
    font-size: 2.8rem;
    margin-bottom: 8px;
  }

  .letter-choices-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .letter-choice-card {
    flex-direction: row;
    justify-content: flex-start;
    padding: 8px 16px;
    gap: 16px;
  }

  .letter-choice-emoji {
    font-size: 2.4rem;
  }

  .letter-choice-label {
    font-size: 1.25rem;
  }

  /* Game 3 */
  .color-choices-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .color-item-icon {
    width: 65px;
    height: 65px;
    font-size: 2.2rem;
  }

  .color-item-name {
    font-size: 1.1rem;
  }

  /* Game 4 */
  .shapes-choices-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .shape-choice-card {
    padding: 10px 8px;
  }

  .shape-svg-wrapper {
    width: 65px;
    height: 65px;
  }

  .shape-name {
    font-size: 1.05rem;
  }

  /* Game 5: Puzzle */
  .puzzle-frame {
    width: 270px;
    height: 200px;
  }

  .puzzle-pieces-tray {
    padding: 8px 12px;
    min-height: 80px;
    gap: 12px;
  }

  /* Modal */
  .modal-card {
    padding: 20px 16px;
  }

  .result-title {
    font-size: 2rem;
  }

  .result-star-item {
    font-size: 2.8rem;
  }
}

/* Smartphone & Small Tablet Landscape Mode */
@media (max-height: 520px) and (orientation: landscape) {
  .top-bar {
    padding: 4px 16px;
  }

  .home-title {
    font-size: 1.8rem;
  }

  .home-momo-stage {
    transform: scale(0.65);
    margin: -10px 0;
  }

  .speech-bubble-momo {
    top: -5px;
  }

  .btn-large-play {
    padding: 10px 24px;
    font-size: 1.2rem;
  }

  .btn-game {
    min-height: 42px;
    padding: 8px 18px;
    font-size: 1.1rem;
  }

  .game-play-area {
    padding: 4px 10px 10px;
  }

  .game-instruction-banner {
    padding: 4px 12px;
    margin-bottom: 4px;
  }

  .instruction-text {
    font-size: 1.05rem;
  }

  .game-progress-bar {
    margin-bottom: 4px;
  }

  .fruit-stage-container {
    padding: 8px;
    margin-bottom: 8px;
  }

  .fruit-item {
    font-size: 2.4rem;
  }

  .btn-number-option {
    height: 55px;
    font-size: 1.8rem;
  }

  .letter-hero-badge {
    width: 65px;
    height: 65px;
    font-size: 2.2rem;
    margin-bottom: 4px;
  }

  .letter-choice-card {
    padding: 6px;
  }

  .letter-choice-emoji {
    font-size: 2rem;
  }

  .puzzle-game-board {
    flex-direction: row;
    gap: 15px;
  }

  .puzzle-frame {
    width: 250px;
    height: 180px;
  }

  .puzzle-pieces-tray {
    flex-direction: column;
    width: auto;
    max-height: 190px;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .result-momo {
    width: 90px;
    height: 90px;
    margin-top: -50px;
  }
}
