/* responsive.css - レスポンシブデザイン用スタイル */

/* ベースとなるメディアクエリ変数 */
:root {
  --mobile-breakpoint: 576px;
  --tablet-breakpoint: 768px;
  --desktop-breakpoint: 992px;
  --large-desktop-breakpoint: 1200px;
}

/* モバイルファースト設計: デフォルトはモバイル向け */
/* ===== モバイル共通スタイル (576px未満) ===== */

/* ハンバーガーメニューの表示 */
.hamburger {
  display: block;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
  transition: opacity 0.3s ease;
}

.hamburger:hover {
  opacity: 0.8;
}

@media (min-width: 768px) {
  .hamburger {
    display: none;
  }
}

/* モバイルメニュー */
#mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  height: 100vh;
  background-color: var(--bg-secondary);
  z-index: 999;
  transition: transform 0.3s ease;
  overflow-y: auto;
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
}

#mobile-menu.translate-x-full {
  transform: translateX(100%);
}

/* ナビゲーション制御 */
@media (max-width: 767px) {
  .nav-menu {
    display: none;
  }
}

/* サイドバー制御 */
aside {
  display: none;
}

@media (min-width: 768px) {
  aside {
    display: block;
  }
}

/* メインコンテンツフルワイド */
main {
  margin-left: 0;
  padding: 10px;
}

/* ゲーム画面サイズ調整 */
#game-container {
  width: 100%;
  min-height: 400px;
}

#maze-canvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1;
}

/* 問題表示エリア */
#problem-display {
  font-size: 1rem;
  padding: 10px;
}

/* コントロールエリア */
.game-controls {
  flex-direction: column;
  gap: 10px;
}

.level-selector {
  width: 100%;
}

/* ステータス表示 */
.game-status {
  flex-direction: column;
}

/* フッターコンテンツ縦並び */
footer .footer-content {
  flex-direction: column;
  gap: 15px;
  text-align: center;
}

/* ===== タブレット向けスタイル (576px以上) ===== */
@media screen and (min-width: 576px) {
  #game-container {
    min-height: 450px;
  }
  
  #maze-canvas {
    max-width: 450px;
  }
  
  #problem-display {
    font-size: 1.1rem;
  }
  
  /* コントロールエリアは横並び可能に */
  .game-controls {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .level-selector {
    width: auto;
  }
  
  /* ステータス表示も横並び */
  .game-status {
    flex-direction: row;
    justify-content: space-between;
  }
}

/* ===== 中型タブレット向けスタイル (768px以上) ===== */
@media screen and (min-width: 768px) {
  /* ヘッダーに余裕をもたせる */
  header {
    padding: 15px 20px;
  }
  
  #game-container {
    min-height: 500px;
  }
  
  #maze-canvas {
    max-width: 500px;
  }
  
  /* フッターコンテンツは横並び */
  footer .footer-content {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
  
  /* 2カラムレイアウト対応 */
  .two-column-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
}

/* ===== デスクトップ向けスタイル (992px以上) ===== */
@media screen and (min-width: 992px) {
  /* ハンバーガーメニュー非表示 */
  .hamburger {
    display: none;
  }
  
  /* モバイルメニュー非表示 */
  #mobile-menu {
    display: none;
  }
  
  /* PCナビゲーション表示 */
  .nav-menu {
    display: flex;
  }
  
  /* メインコンテンツに左マージン */
  main {
    margin-left: 220px;
    padding: 20px;
  }
  
  /* ゲーム画面サイズ拡大 */
  #game-container {
    min-height: 600px;
  }
  
  #maze-canvas {
    max-width: 600px;
  }
  
  #problem-display {
    font-size: 1.2rem;
    padding: 15px;
  }
  
  /* 3カラムレイアウト対応 */
  .three-column-layout {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
  }
}

/* ===== 大型デスクトップ向けスタイル (1200px以上) ===== */
@media screen and (min-width: 1200px) {
  /* サイドバー調整 */
  aside {
    width: 250px;
  }
  
  main {
    margin-left: 250px;
    padding: 30px;
  }
  
  /* ゲーム画面最大サイズ */
  #game-container {
    min-height: 700px;
    max-width: 1000px;
    margin: 0 auto;
  }
  
  #maze-canvas {
    max-width: 700px;
  }
  
  #problem-display {
    font-size: 1.3rem;
  }
  
  /* 4カラムレイアウト対応 */
  .four-column-layout {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 20px;
  }
}

/* ===== 文字サイズ変更機能 ===== */
/* JS連携: data-font-size属性で制御 */
body[data-font-size="xs"] {
  font-size: 0.8rem;
}

body[data-font-size="s"] {
  font-size: 0.9rem;
}

body[data-font-size="m"] {
  font-size: 1rem;
}

body[data-font-size="l"] {
  font-size: 1.1rem;
}

body[data-font-size="xl"] {
  font-size: 1.2rem;
}

/* 印刷用スタイル */
@media print {
  .no-print {
    display: none !important;
  }
  
  main {
    margin: 0;
    padding: 0;
  }
  
  aside,
  #mobile-menu,
  .hamburger {
    display: none;
  }
  
  /* 印刷時のコントラスト確保 */
  body {
    background: white;
    color: black;
  }
  
  a {
    color: blue;
  }
}

/* アクセシビリティ対応 - ハイコントラストモード */
@media (prefers-contrast: high) {
  :root {
    --primary-color: #0000EE;
    --secondary-color: #990000;
    --text-color: #000000;
    --bg-color: #FFFFFF;
    --bg-secondary: #F0F0F0;
  }
  
  * {
    border-color: black !important;
  }
}

/* アニメーション無効化設定 */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* 方向転換対応（縦向き/横向き） */
@media screen and (orientation: portrait) {
  .orientation-specific-layout {
    flex-direction: column;
  }
}

@media screen and (orientation: landscape) {
  .orientation-specific-layout {
    flex-direction: row;
  }
}