/* ========================================
   Responsive Design
   ======================================== */

/* Landscape Orientation (Mobile) */
@media (max-height: 500px) and (orientation: landscape) {
  .tab-navigation {
    top: 5px;
    padding: 3px 8px;
    min-width: 160px;
    gap: 4px;
  }
  
  .tab-button {
    padding: 6px 18px;
    font-size: 14px;
    min-width: 40px;
    border-radius: 20px;
  }
  
  #galleryTab,
  #settingsTab {
    margin-top: 40px;
  }
  
  .camera-controls {
    bottom: 8px;
  }
  
}

/* Very Small Landscape (iPhone SE横など) */
@media (max-height: 400px) and (orientation: landscape) {
  .tab-navigation {
    top: 3px;
    padding: 2px 6px;
    min-width: 120px;
    gap: 3px;
  }
  
  #galleryTab,
  #settingsTab {
    margin-top: 35px;
  }
  
  .camera-controls {
    bottom: 6px;
  }
  
}

/* Mobile Base Styles */
@media (max-width: 700px) {
  body.front-page {
    display: block;
    overflow: hidden;
    margin: 0;
    padding: 0;
  }

  #app {
    position: relative;
    flex-direction: column;
    gap: 15px;
    padding: 10px;
    height: 100vh;
    max-width: 100vw;
    width: 100vw;
  }
  
  /* Mobile Tab Navigation */
  .tab-navigation {
    order: 1;
    margin-bottom: 0;
    padding: 6px;
    gap: 10px;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    top: 15px;
    min-width: 220px;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .tab-button {
    padding: 8px 16px;
    font-size: 10px;
    min-width: 50px;
    border-radius: 16px;
  }
  
  .tab-content.active {
    flex-direction: column;
    gap: 15px;
    width: 100%;
  }
  
  /* Mobile Camera */
  #cameraTab {
    order: 2;
    width: 100%;
    padding: 0;
  }
  
  #galleryTab {
    order: 3;
    width: 100%;
    margin-top: 70px;
  }
  
  #settingsTab {
    order: 3;
    width: 100%;
    margin-top: 70px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    height: calc(100vh - 140px); /* タブナビゲーションとマージンを除いた高さ */
  }
  
  .webcam {
    order: 1;
    width: 100%;
    max-width: 100vw;
  }
  
  .buttons {
    order: 2;
    justify-content: center;
    width: 100%;
    padding: 0 10px;
  }
  
  .photo-gallery {
    order: 3;
    width: 100%;
    padding-bottom: 0;
    margin-bottom: 0;
  }
  
  .gallery-container {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding-bottom: 0;
    margin-bottom: 0;
  }
  
  .settings-content {
    order: 3;
    min-width: auto;
    padding: 20px;
    width: 100%;
  }
  
  .camera-controls {
    bottom: 20px;
  }
  
  .shutter-button {
    width: 60px;
    height: 60px;
  }
  
  .shutter-button img {
    width: 100%;
    height: 100%;
  }
  
  .sound-dialog-content {
    width: 95%;
    margin: 20px;
  }

  /* Mobile Navigation Buttons */
  .nav-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  .prev-btn {
    left: -10px; /* レスポンシブでは適度に外側に */
  }
  
  .next-btn {
    right: -10px; /* レスポンシブでは適度に外側に */
  }
  
  
  
  /* Mobile Expression Display */
  .expression-display {
    bottom: 100px;
    padding: 12px 20px;
    min-width: 130px;
    font-size: 16px;
  }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
  #app {
    padding: 5px;
    gap: 10px;
  }
  
  .tab-navigation {
    margin-bottom: 0;
    padding: 4px;
    border-radius: 50px;
    top: 10px;
    min-width: 240px;
    gap: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .tab-button {
    padding: 8px 12px;
    font-size: 12px;
    min-width: 60px;
    border-radius: 14px;
  }
  
  #galleryTab {
    margin-top: 60px;
  }
  
  #settingsTab {
    margin-top: 60px;
  }
  
  .buttons {
    padding: 0 5px;
  }
  
  .webcam {
    margin: 0;
  }
  
  .camera-controls {
    bottom: 20px;
  }
  
  .shutter-button {
    width: 60px;
    height: 60px;
  }
  
  .shutter-button img {
    width: 100%;
    height: 100%;
  }

}

/* 横向き画面での右端縦並びレイアウト（responsive.css） */
@media (orientation: landscape) and (min-width: 768px) and (max-height: 600px) {
 
  .powered-by-text {
    position: fixed !important;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 14px !important;
    background: rgba(0,0,0,0.2);
  }
}

/* Tablet and Medium Devices */
@media (max-width: 768px) {
  .tab-content.active {
    gap: 20px;
  }
  
  .settings-content {
    padding: 20px 15px;
    min-width: 280px;
  }
  
  .sound-selection,
  .stamp-selection {
    padding: 0px 0px 60px;
  }
  
  .photo-gallery {
    padding: 15px 15px 0 15px;
    margin-bottom: 0;
  }
  
  .gallery-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding-bottom: 0;
    margin-bottom: 0;
  }
  
  .sound-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
  
  .sound-list .sound-option {
    padding: 15px;
  }
  
  .sound-list .sound-image {
    width: 60px;
    height: 60px;
  }
  
  /* Mobile Default Sound Setting */
  .default-sound-setting {
    padding: 20px;
    margin-top: 30px;
  }
  
  .default-sound-controls {
    flex-direction: column;
    gap: 10px;
  }
  
  .default-sound-btn {
    min-width: auto;
  }
}
