/* 統合フッターUI */
.unified-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(44, 62, 80, 0.95);
  backdrop-filter: blur(10px);
  border-top: 2px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: center; /* 中央配置 */
  align-items: center;
  padding: 6px 20px;
  z-index: var(--z-footer);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  min-height: 50px;
}

/* 固定メインボタン群 - 常に中央固定 */
.footer-main-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

/* フッターによりコンテンツが隠れないように下部マージンを追加 */
/* デスクトップでは本の見開きデザインのため下部マージンを調整 */
@media (min-width: 1401px) {
  .book-spread-container {
    margin-bottom: 30px; /* デスクトップでは控えめなマージン */
  }
}

/* モバイル・タブレット用のマージン - style_responsive.cssで統一管理 */

/* 全ボタン統一スタイル */
.footer-button {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  border: none;
  padding: 0 8px;
  border-radius: 18px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
  min-width: 100px;
  max-width: 140px;
  height: 34px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 章ナビボタン専用スタイル */
.footer-button.chapter-nav {
  background: linear-gradient(135deg, #8e44ad, #9b59b6);
  box-shadow: 0 2px 8px rgba(142, 68, 173, 0.3);
  max-width: 200px; /* より広い幅を許可 */
  padding: 0 12px; /* 内側パディングを追加 */
  position: absolute; /* 絶対位置指定 */
  top: 50%;
  transform: translateY(-50%);
}

.footer-button.chapter-nav.prev-chapter {
  left: 20px;
}

.footer-button.chapter-nav.next-chapter {
  right: 20px;
}

.footer-button.chapter-nav:hover {
  background: linear-gradient(135deg, #9b59b6, #8e44ad);
  transform: translateY(-52%);
  box-shadow: 0 5px 15px rgba(142, 68, 173, 0.4);
}

.footer-button.chapter-nav:active {
  transform: translateY(-50%);
  box-shadow: 0 2px 5px rgba(142, 68, 173, 0.3);
}

.footer-button:hover {
  background: linear-gradient(135deg, #2980b9, #1f639a);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.footer-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 5px rgba(52, 152, 219, 0.3);
}

/* スクロール案内ボタンの点滅効果 - PCのみ */
#scrollHintButton {
  animation: hintPulse 3s ease-in-out infinite;
}

#scrollHintButton:hover {
  animation: none;
}

@keyframes hintPulse {
  0%, 70%, 100% { 
    box-shadow: 0 3px 10px rgba(52, 152, 219, 0.3);
  }
  35% { 
    box-shadow: 0 3px 15px rgba(52, 152, 219, 0.6);
    transform: translateY(-1px);
  }
}

/* 説明モーダル */
.scroll-explanation-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.scroll-explanation-content {
  background: white;
  padding: 2rem;
  border-radius: 15px;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.scroll-explanation-title {
  font-size: 1.5rem;
  font-weight: bold;
  color: #2c3e50;
  margin-bottom: 1rem;
}

.scroll-explanation-text {
  color: #555;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.scroll-explanation-close {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  border: none;
  padding: 0.8rem 2rem;
  border-radius: 25px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.scroll-explanation-close:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

/* レスポンシブ対応 - 全ボタン統一管理 */
@media (max-width: 1400px) {
  .unified-footer {
    padding: 6px 15px;
    min-height: 45px;
    gap: 12px; /* タブレット用の隙間 */
  }
  
  .footer-main-buttons {
    gap: 12px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
  
  .footer-button {
    font-size: 11px;
    min-width: 80px;
    max-width: 120px;
    height: 32px;
  }
  
  .footer-button.chapter-nav {
    max-width: 160px; /* タブレット版でも広い幅 */
    padding: 0 10px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
  }
  
  .footer-button.chapter-nav.prev-chapter {
    left: 15px;
  }
  
  .footer-button.chapter-nav.next-chapter {
    right: 15px;
  }
  
  /* ページ移動ボタンのみモバイルで非表示 */
  #scrollHintButton {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .unified-footer {
    padding: 5px 10px;
    min-height: 40px;
    gap: 8px; /* モバイル用の隙間 */
  }
  
  .footer-main-buttons {
    gap: 8px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
  
  .footer-button {
    font-size: 10px;
    min-width: 60px;
    max-width: 90px;
    height: 30px;
  }
  
  .footer-button.chapter-nav {
    max-width: 120px; /* モバイル版での広い幅 */
    padding: 0 8px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
  }
  
  .footer-button.chapter-nav.prev-chapter {
    left: 10px;
  }
  
  .footer-button.chapter-nav.next-chapter {
    right: 10px;
  }
}

@media (max-width: 480px) {
  .unified-footer {
    padding: 4px 8px;
    min-height: 38px;
    gap: 6px; /* 小型モバイル用の隙間 */
  }
  
  .footer-main-buttons {
    gap: 6px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
  
  .footer-button {
    font-size: 9px;
    min-width: 50px;
    max-width: 75px;
    height: 28px;
  }
  
  .footer-button.chapter-nav {
    max-width: 100px; /* 小型モバイル版での広い幅 */
    padding: 0 6px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
  }
  
  .footer-button.chapter-nav.prev-chapter {
    left: 8px;
  }
  
  .footer-button.chapter-nav.next-chapter {
    right: 8px;
  }
}

/* デスクトップ版 */
@media (min-width: 1401px) {
  .menu-toggle-button {
    display: none;
  }
  
  /* メニューラッパーをフッター使用時は元のスタイルで表示 */
  .menu-wrapper {
    display: block; /* 表示を復元 */
    z-index: calc(var(--z-footer) + 1); /* フッターより上に表示 */
  }
  
  /* PC版では章ナビボタンを固定位置に配置 */
  .footer-button.chapter-nav.prev-chapter {
    position: fixed;
    bottom: 8px;
    left: 20px;
  }
  
  .footer-button.chapter-nav.next-chapter {
    position: fixed;
    bottom: 8px;
    right: 20px;
  }
  
  /* フッター内のメインボタン群のみ中央配置 */
  .unified-footer {
    justify-content: center;
  }
  
  .footer-main-buttons {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
}