* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #f5f5f5;
  color: #333;
}

header {
  /* 曇りガラス風の半透明背景 (アルファ 0.3) */
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  /* ドロップシャドウ */
  box-shadow: 
    0 4px 16px rgba(0,0,0,0.15),
    0 2px 8px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.site-subtitle {
  font-size: 12px;
  color: #888;
  margin: 0;
  padding-left: 2px;
}

h1 {
  font-size: 24px;
  color: #333;
}

h1 a {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s ease;
}

h1 a:hover {
  color: #667eea;
}

.header-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.category-menu {
  position: relative;
}

.language-menu {
  position: relative;
}

.menu-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.language-btn,
.category-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
  white-space: nowrap;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; /* 国旗絵文字対応 */
}

.menu-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.language-btn:hover,
.category-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.category-dropdown,
.language-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  margin-top: 8px;
  min-width: 200px;
  overflow: hidden;
  z-index: 1001;
}

.category-dropdown.show,
.language-dropdown.show {
  display: block;
}

.category-item,
.language-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: #333;
  text-decoration: none;
  transition: background 0.3s ease;
  font-size: 15px;
  cursor: pointer;
}

.category-item:hover,
.language-item:hover {
  background: #f5f5f5;
}

.language-dropdown {
  max-height: 400px;
  overflow-y: auto;
}

/* ========================================
   タグフィルターバー（Pexels風）
   ======================================== */

.tags-filter-bar {
  /* 曇りガラス風の半透明背景 (アルファ 0.3) */
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  position: sticky;
  top: 76px;
  z-index: 999;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* タグバーラッパー（矢印を右左端に配置） */
.tags-filter-wrapper {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  padding: 0 20px;
}

/* 矢印ボタン */
.scroll-arrow {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
  color: #667eea;
  font-size: 18px;
  font-weight: bold;
  z-index: 10;
  margin: 0 10px;
}

.scroll-arrow:hover {
  background: #667eea;
  color: white;
  border-color: #667eea;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.scroll-arrow:active {
  transform: scale(0.95);
}

.scroll-left {
  /* margin-left: 10px; 削除 */
}

.scroll-right {
  /* margin-left: 10px; 削除 */
}

/* 横スクロールコンテナ */
.tags-scroll-container {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1;
  position: relative;
  /* max-width を削除して親幅いっぱいに表示 */
  margin: 0;
  padding: 12px 0;  /* 上下のパディングを追加 */
}

.tags-scroll-container::-webkit-scrollbar {
  display: none;
}

/* タグボタンコンテナ */
#tagsButtons {
  display: flex;
  gap: 10px;
  padding: 15px 0;
  white-space: nowrap;
  min-width: min-content;
}

/* タグフィルターボタン（絵文字のみ） */
.tag-filter-btn {
  padding: 10px 16px;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: 20px;
  font-size: 22px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #333;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tag-filter-btn:hover {
  border-color: #667eea;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2);
}

/* アクティブなタグボタン */
.tag-filter-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.tag-filter-btn.active:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

/* ========================================
   メインコンテンツ
   ======================================== */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px;
  min-height: 400px;
}

/* トップページ: 左右幅なし、フルスクリーン */
body.index-page .container {
  max-width: 100%;
  padding: 20px 0;
  margin: 0;
}

.page-title {
  font-size: 32px;
  margin-bottom: 30px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 12px;
}

.category-section {
  margin-bottom: 50px;
  transition: opacity 0.3s ease;
  display: flex;
  flex-direction: column;
}

/* タイトルと「もっと見る」リンクのラッパー */
.title-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.category-section.hidden {
  display: none;
}

.category-title {
  font-size: 28px;
  margin-bottom: 20px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.category-title:hover {
  color: #667eea;
  text-decoration: underline;
}

.more-link {
  font-size: 16px;
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
  white-space: nowrap;
}

body.index-page .more-link {
  font-size: 14px;
}

.more-link:hover {
  color: #764ba2;
  text-decoration: underline;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 25px;
  margin-bottom: 30px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 25px;
  margin-bottom: 30px;
}

.image-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  height: 280px;  /* 固定高さに変更 */
}

.image-card a {
  display: block;
  text-decoration: none;
  color: inherit;
}

.image-card:hover {
  transform: translateY(-8px) rotate(-1deg);
  box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}

.image-card img {
  width: 100%;
  height: 280px;  /* 固定高さに変更 */
  display: block;
  object-fit: cover;  /* coverに戻す */
  /* aspect-ratio削除: 画像の元の比率を使用 */
}
  /* background: #f0f0f0; 削除：背景色が画像を隠す原因 */
}

.loading {
  text-align: center;
  padding: 50px;
  font-size: 18px;
  color: #999;
}

.empty {
  text-align: center;
  padding: 50px;
  font-size: 18px;
  color: #999;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ========================================
   フッター
   ======================================== */

footer {
  text-align: center;
  padding: 30px 20px;
  background: white;
  border-top: 1px solid #e0e0e0;
  color: #666;
  font-size: 14px;
}

/* ========================================
   レスポンシブ対応
   ======================================== */

/* PC版: フルスクリーンアニメーションデザイン */
@media (min-width: 769px) {
  body.index-page {
    background: #ffffff;
    transition: background 0.5s ease;
    position: relative;
    overflow: hidden;
  }
  
  /* トップページのヘッダーを非表示 */
  body.index-page header {
    display: none;
  }
  
  /* 整列ボタン: 左上固定、サイズ2倍 */
  body.index-page .arrange-button {
    position: fixed;
    bottom: 30px; /* Changed from top: 20px */
    left: 50%; /* Center horizontally */
    transform: translateX(-50%); /* Center alignment */
    font-size: 64px;  /* 32px×2 */
    background: none;
    border: none;
    cursor: pointer;
    padding: 16px 32px;  /* 2倍 */
    transition: transform 0.2s ease, filter 0.2s ease;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
    z-index: 9999;
  }
  
  body.index-page .arrange-button:hover {
    transform: translateX(-50%) scale(1.15); /* Maintain center alignment */
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.4));
  }
  
  body.index-page .arrange-button:active {
    transform: translateX(-50%) scale(1.05); /* Maintain center alignment */
  }
  
  /* 背景画像表示機能を削除 */
  

  body.index-page #categoriesContainer {
    position: relative;
    width: 100vw;
    height: 100vh;  /* ヘッダーがないので100vh */
    padding: 0;
    margin: 0;
    overflow: visible;
    z-index: 1;
  }
  
  body.index-page .category-section {
    position: absolute !important;
    margin: 0;
    display: block !important;  /* flexをblockに変更 */
    transition: none;
  }
  
  body.index-page .category-title {
    position: absolute;
    top: 10px;  /* 画像内の上合わせ */
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(14px, 2.5vw, 24px);
    font-weight: bold;
    color: #ffffff;  /* 白文字 */
    text-align: center;
    white-space: nowrap;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    padding: 0;
    background: none;  /* 背景色を削除 */
    border-radius: 0;
    box-shadow: none;  /* 箱の影を削除 */
    /* 白いグロー効果 */
    text-shadow: 
      0 0 10px rgba(255, 255, 255, 0.8),
      0 0 20px rgba(255, 255, 255, 0.6),
      0 0 30px rgba(255, 255, 255, 0.4),
      /* ドロップシャドウ */
      2px 2px 4px rgba(0, 0, 0, 0.8),
      4px 4px 8px rgba(0, 0, 0, 0.5);
    z-index: 10;
  }
  
  body.index-page .more-link {
    display: none;
  }
  
  body.index-page .title-wrapper {
    position: relative;
    width: 100%;
    margin: 0;
  }
  
  body.index-page .image-grid {
    position: relative;
    width: 100%;
    height: 100%;
    display: block;
  }
  
  body.index-page .image-card {
    position: relative;
    border-radius: 20px;  /* 角を丸く */
    overflow: hidden;  /* 角丸を適用 */
    cursor: pointer;
    /* 強いドロップシャドウ */
    box-shadow: 
      0 10px 30px rgba(0,0,0,0.3),
      0 5px 15px rgba(0,0,0,0.2);
    transition: box-shadow 0.3s ease;
    /* 初期状態で非表示（フェードイン用） */
    opacity: 0;
    transition: opacity 0.5s ease, box-shadow 0.3s ease;
  }
  
  /* ホバー時のハイライトとキランエフェクトを削除 */
  body.index-page .image-card:hover {
    box-shadow: 
      0 15px 40px rgba(0,0,0,0.4),
      0 8px 20px rgba(0,0,0,0.25);
  }
  
  /* PC版: 画像のスタイル */
  body.index-page .image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
}

@media (max-width: 768px) {
  /* トップページ: モバイルではカテゴリを2列表示 */
  body.index-page #categoriesContainer {
    display: grid;  /* カテゴリを2列に並べる */
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;  /* カテゴリ間の間隔 */
    max-width: 100%;
    padding: 0 10px;  /* 左右に10pxのマージン */
    box-sizing: border-box;  /* パディングを幅に含める */
  }
  
  body.index-page .category-section {
    margin-bottom: 0;  /* gapを使用するため余白削除 */
    width: 100%;  /* 明示的に幅を指定 */
    display: flex;
    flex-direction: column;
    align-items: flex-start;  /* 左寄せに変更 */
  }
  
  /* モバイル: 画像グリッドとカードの幅を100%に */
  body.index-page .image-grid {
    width: 100%;
    display: flex;
    justify-content: flex-start;  /* 左寄せに変更 */
  }
  
  body.index-page .image-card {
    width: 100% !important;
    min-width: 0;  /* 最小幅を解除 */
    height: 0;  /* 高さをリセット */
    padding-bottom: 133.33%;  /* 3:4の縦横比 (4/3 * 100% = 133.33%) */
    position: relative;  /* 子要素を絶対配置するため */
  }
  
  body.index-page .image-card img {
    position: absolute;  /* 親要素に対して絶対配置 */
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;  /* 親要素の高さいっぱいに */
    object-fit: cover;
  }
  
  /* モバイル: タイトルと「もっと見る」を縦並びに */
  .title-wrapper {
    flex-direction: column;
    align-items: flex-start;  /* 左寄せ */
    gap: 5px;
    width: 100%;  /* 幅を100%に */
  }
  
  .header-content {
    padding: 15px;
  }
  
  h1 {
    font-size: 18px;
  }
  
  .menu-btn {
    padding: 10px 16px;
    font-size: 14px;
  }
  
  .tags-filter-bar {
    top: 63px;
    padding: 0 10px;
  }
  
  .tags-filter-wrapper {
    padding: 0; /* モバイルで左右の余白を削除 */
  }
  
  .tags-scroll-container {
    padding: 4px 0; /* 上下スペースを3分の1に */
  }
  
  .scroll-arrow {
    width: 35px;
    height: 35px;
    font-size: 16px;
    margin: 0; /* 左右端に配置 */
  }
  
  .scroll-arrow:first-child {
    margin-left: 0; /* 左端に寄せる */
  }
  
  .scroll-arrow:last-child {
    margin-right: 0; /* 右端に寄せる */
  }
  
  .scroll-left {
    margin-right: 8px;
  }
  
  .scroll-right {
    margin-left: 8px;
  }
  
  .tags-buttons {
    gap: 8px;
    padding: 4px 0; /* 上下スペースを3分の1に */
  }
  
  .tag-filter-btn {
    padding: 8px 14px;
    font-size: 20px;
    min-width: 45px;
  }
  
  .container {
    padding: 20px 15px;
  }
  
  /* トップページ: モバイルではpaddingを最小限に */
  body.index-page .container {
    padding: 20px 0;  /* 上下のみパディング */
    box-sizing: border-box;
  }
  
  .page-title {
    font-size: 24px;
    margin-bottom: 20px;
  }
  
  .category-title {
    font-size: 22px;
    margin-bottom: 15px;
  }
  
  .image-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
  }
  
  /* トップページ: モバイルでざ1列表示 */
  body.index-page .image-grid {
    grid-template-columns: 1fr;  /* 1列表示(各カテゴリ1枚のみ) */
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 16px;
  }
  
  .menu-btn {
    padding: 8px 12px;
    font-size: 13px;
  }
  
  .scroll-arrow {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  .tag-filter-btn {
    padding: 6px 12px;
    font-size: 18px;
    min-width: 42px;
  }
  
  .page-title {
    font-size: 20px;
  }
  
  .category-title {
    font-size: 18px;
  }
  
  .image-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
}

/* ========================================
   カテゴリヘッダー
   ======================================== */

.category-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 30px;
  padding: 20px 0;
  border-bottom: 2px solid #667eea;
}

.category-header span {
  font-size: 48px;
}

.category-header h2 {
  font-size: 32px;
  color: #333;
  margin: 0;
  font-weight: 600;
}

@media (max-width: 768px) {
  .category-header {
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px 0;
  }
  
  .category-header span {
    font-size: 36px;
  }
  
  .category-header h2 {
    font-size: 24px;
  }
}

/* ========================================
   詳細ページ（detail.html）
   ======================================== */

.detail-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #667eea;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 20px;
  transition: all 0.3s ease;
}

.back-link:before {
  content: '←';
  font-size: 20px;
}

.back-link:hover {
  color: #764ba2;
  transform: translateX(-5px);
}

/* 画像ナビゲーション */
/* Navigation controls container */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  flex-shrink: 0;
}

.nav-btn:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.6);
}

.nav-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.nav-btn-disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.nav-btn-back {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
}

.nav-btn-back:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(245, 87, 108, 0.6);
}

.nav-btn-back:active {
  transform: translateY(0);
}

/* 画像コンテナ */
.detail-image-container {
  width: 100%;
  max-width: 1200px;
  max-height: 90vh;  /* 画面の90%の高さまで */
  margin: 0 auto 30px;
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-image {
  width: 100%;
  max-height: 90vh;  /* 画面の90%の高さまで */
  height: auto;
  display: block;
  object-fit: contain;  /* 詳細ページは全体表示 */
}

/* 広告コンテナ */
.ad-container {
  max-width: 1200px;
  margin: 30px auto;
  padding: 20px;
  background: #f9f9f9;
  border-radius: 12px;
  text-align: center;
  min-height: 90px;
}

/* ダウンロードボタン */
.detail-actions {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: center;
  margin: 30px 0;
  flex-wrap: wrap;
}

.action-buttons {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

/* Goodボタン */
.vote-btn {
  background: white;
  color: #ff6b6b;
  border: 2px solid #ff6b6b;
  padding: 16px 32px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.2);
  min-width: 200px;
}

.vote-btn:hover {
  background: #ff6b6b;
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
}

.vote-btn:active {
  transform: translateY(-1px);
}

.vote-btn:disabled {
  opacity: 0.8;
  cursor: not-allowed;
}

.download-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 16px 32px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  min-width: 200px;
}

.download-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.6);
}

.download-btn:active {
  transform: translateY(-1px);
}

.download-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.download-btn-pc {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  width: 240px; /* PCとスマホのボタン幅を完全に統一 */
  flex-shrink: 0; /* 縮小を防ぐ */
}

.download-btn-phone {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  width: 240px; /* PCとスマホのボタン幅を完全に統一 */
  flex-shrink: 0; /* 縮小を防ぐ */
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .detail-page {
    padding: 15px;
  }
  
  .back-link {
    font-size: 14px;
    margin-bottom: 15px;
  }
  
  .nav-btn {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
  
  .detail-image-container {
    margin-bottom: 20px;
    border-radius: 12px;
  }
  
  .ad-container {
    margin: 20px auto;
    padding: 15px;
  }
  
  .detail-actions {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }
  
  .nav-controls {
    justify-content: center;
    width: 100%;
  }
  
  .action-buttons {
    width: 100%;
    justify-content: center;
  }
  
  .nav-btn-back {
    padding: 10px 20px;
    font-size: 13px;
  }
  
  .download-btn {
    width: 100%;
    min-width: auto;
    padding: 14px 24px;
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .detail-page {
    padding: 10px;
  }
  
  .back-link {
    font-size: 13px;
  }
  
  .nav-btn {
    width: 35px;
    height: 35px;
    font-size: 18px;
  }
  
  .detail-image-container {
    border-radius: 8px;
  }
  
  .download-btn {
    padding: 12px 20px;
    font-size: 15px;
  }
}

/* ========================================
   利用規約ページ
   ======================================== */

.terms-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px;
}

.terms-page h1 {
  font-size: 36px;
  color: #333;
  text-align: center;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 3px solid #667eea;
}

.terms-section {
  margin-bottom: 40px;
  padding: 30px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.terms-section h2 {
  font-size: 24px;
  color: #667eea;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.terms-section h2:before {
  content: '📋';
  font-size: 28px;
}

.terms-section p {
  font-size: 16px;
  line-height: 1.8;
  color: #555;
  margin-bottom: 15px;
}

.terms-section ul {
  list-style: none;
  padding-left: 0;
  margin-top: 15px;
}

.terms-section ul li {
  font-size: 16px;
  line-height: 1.8;
  color: #555;
  padding: 10px 0;
  padding-left: 30px;
  position: relative;
}

.terms-back {
  text-align: center;
  margin-top: 50px;
}

.back-btn {
  display: inline-block;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-decoration: none;
  padding: 15px 40px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.back-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.6);
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .terms-page {
    padding: 30px 15px;
  }
  
  .terms-page h1 {
    font-size: 28px;
    margin-bottom: 30px;
  }
  
  .terms-section {
    padding: 20px;
    margin-bottom: 30px;
  }
  
  .terms-section h2 {
    font-size: 20px;
  }
  
  .terms-section p,
  .terms-section ul li {
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  .terms-page h1 {
    font-size: 24px;
  }
  
  .terms-section {
    padding: 15px;
  }
  
  .terms-section h2 {
    font-size: 18px;
  }
  
  .terms-section p,
  .terms-section ul li {
    font-size: 14px;
  }
}

/* ヘッダーに利用規約リンクを追加 */
.terms-link,
.popular-link,
.privacy-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #667eea;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.3s ease;
  background: rgba(102, 126, 234, 0.1);
}

.terms-link:hover,
.popular-link:hover,
.privacy-link:hover {
  background: rgba(102, 126, 234, 0.2);
  transform: translateY(-2px);
}

/* ===== 画像の遅延読み込み & アニメーション ===== */
.image-card {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.image-card.loaded {
  opacity: 1;
  transform: translateY(0);
}

.image-card img {
  width: 100%;
  height: 280px;  /* 固定高さに変更 */
  display: block;
  object-fit: cover;  /* coverに戻す */
  opacity: 1 !important;
  visibility: visible !important;
  position: relative;
  z-index: 1;
  transition: opacity 0.4s ease;
}

.image-card img.loaded {
  opacity: 1 !important;
  display: block !important;
}

/* 人気ランキングページ用（詳細度を上げる） */
.popular-card img {
  width: 100% !important;
  height: auto !important;
  object-fit: contain !important;
  display: block !important;
}

.popular-card img.loaded {
  opacity: 1 !important;
  display: block !important;
  visibility: visible !important;
}

/* デバッグ用：強制表示 */
.image-card.popular-card img {
  opacity: 1 !important;
}

/* ===== カテゴリページ: 12枚ごとに挿入するAdSense枠 ===== */
.ad-container-grid {
  grid-column: 1 / -1; /* グリッド全幅 */
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 728pxが入らない端末では縮めて表示 */
.ad-container-grid ins.adsbygoogle {
  max-width: 100%;
}

/* ===== 人気ランキングページ専用スタイル ===== */
.rank-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
  color: white;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.rank-badge.rank-gold {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  color: #333;
}

.rank-badge.rank-silver {
  background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
  color: #333;
}

.rank-badge.rank-bronze {
  background: linear-gradient(135deg, #cd7f32, #e8b87d);
  color: white;
}

.vote-info {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 14px;
  font-weight: bold;
  z-index: 10;
  backdrop-filter: blur(5px);
}

/* 画像カードのリンクを relative にして、バッジと投票情報を配置 */
.popular-card a {
  position: relative;
  display: block;
}

/* 画像が確実に表示されるように、z-index を下げる */
.popular-card img {
  position: relative;
  z-index: 1;
}

/* ===== 人気ランキング専用：カードの opacity を強制的に 1 に ===== */
.popular-card {
  opacity: 1 !important;
  transform: translateY(0) !important;
}


/* ===== モバイル用ヘッダー改善 ===== */
@media (max-width: 768px) {
  /* ヘッダー全体を縮小 */
  header {
    padding: 10px 0;
  }
  
  .header-content {
    flex-direction: column;
    gap: 10px;
    padding: 10px 15px;
  }
  
  .header-left {
    text-align: center;
    width: 100%;
  }
  
  .header-left h1 {
    font-size: 16px;
    margin-bottom: 5px;
  }
  
  .site-subtitle {
    font-size: 11px;
  }
  
  .header-actions {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 100%;
  }
  
  .popular-link,
  .terms-link,
  .privacy-link {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .language-menu,
  .category-menu {
    position: relative;
  }
  
  .language-btn,
  .category-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .language-dropdown,
  .category-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 150px;
  }
}
/* ===== 共有ボタンのスタイル（アイコンのみ） ===== */
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: white;
  margin: 5px;
  width: 48px;
  height: 48px;
  min-width: 48px;
}

.share-btn svg {
  width: 24px;
  height: 24px;
}

.share-pinterest {
  background: #E60023;
}

.share-pinterest:hover {
  background: #ad081b;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(230, 0, 35, 0.3);
}

.share-x {
  background: #000000;
}

.share-x:hover {
  background: #333333;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.share-copy {
  background: #667eea;
}

.share-copy:hover {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* モバイル対応 */
@media (max-width: 768px) {
  .share-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 10px;
  }
  
  .share-btn svg {
    width: 20px;
    height: 20px;
  }
}

/* ===== モバイルでヘッダーボタンをアイコンのみに変更 ===== */
@media (max-width: 768px) {
  /* ヘッダーのリンクテキストを非表示 */
  .popular-link span,
  .terms-link span,
  .privacy-link span {
    display: none;
  }
  
  /* アイコンのみ表示 */
  .popular-link,
  .terms-link,
  .privacy-link {
    padding: 8px 12px;
    font-size: 18px;
    min-width: auto;
  }
  
  /* 言語ボタンのテキストを非表示 */
  .language-btn {
    padding: 8px 12px;
    font-size: 18px;
    min-width: auto;
  }
  
  /* カテゴリボタンのテキストを非表示 */
  .category-btn {
    padding: 8px 12px;
    font-size: 18px;
    min-width: auto;
  }
}

/* ===== モバイルでヘッダーボタンを1行表示 ===== */
@media (max-width: 768px) {
  .header-content {
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
  }
  
  .header-left {
    flex: 0 0 auto;
    text-align: left;
  }
  
  .header-left h1 {
    font-size: 14px;
    margin-bottom: 2px;
  }
  
  .site-subtitle {
    font-size: 10px;
  }
  
  .header-actions {
    flex: 1;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 5px;
  }
  
  .popular-link,
  .terms-link,
  .privacy-link,
  .language-btn,
  .category-btn {
    padding: 6px 8px;
    font-size: 16px;
    min-width: 32px;
  }
  
  /* 言語ボタンの span を非表示 */
  .language-btn span {
    display: none;
  }
}

/* ===== AdSense 広告の最適化 ===== */
.ad-container,
.ad-container-grid {
  width: 100%;
  max-width: 1200px;
  margin: 20px auto;
  padding: 15px;
  overflow: hidden;
}

.ad-container ins.adsbygoogle,
.ad-container-grid ins.adsbygoogle {
  display: block;
  width: 100%;
}

/* モバイルでの高さ制限 */
@media (max-width: 768px) {
  .ad-container,
  .ad-container-grid {
    max-height: 300px;
    overflow: hidden;
  }
  
  .ad-container ins.adsbygoogle,
  .ad-container-grid ins.adsbygoogle {
    max-height: 250px;
  }
}

/* ヘッダータイトル行の横並び */
.header-title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.header-title-row h1 {
  margin: 0;
}

.header-title-row .site-subtitle {
  font-size: 14px;
  color: #888;
  white-space: nowrap;
}

/* モバイル: タイトルとサブタイトルを横並び維持 */
@media (max-width: 768px) {
  .header-title-row {
    gap: 8px;
  }
  
  .header-title-row h1 {
    font-size: 16px;
  }
  
  .header-title-row .site-subtitle {
    font-size: 11px;
  }
}

/* モバイルヘッダーボタンの超コンパクト化 */
@media (max-width: 768px) {
  .header-actions {
    gap: 4px !important;
    padding: 0 !important;
  }
  
  .popular-link,
  .terms-link,
  .privacy-link,
  .language-btn,
  .category-btn {
    padding: 6px 8px !important;
    font-size: 16px !important;
    min-width: auto !important;
  }
  
  .language-btn {
    min-width: 36px !important;
  }
  
  .category-btn {
    min-width: 36px !important;
  }
}

/* モバイル: カテゴリページを2列表示 */
@media (max-width: 768px) {
  .image-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 15px;
  }
  
  /* 画像詳細ページを画面いっぱいに表示 */
  .detail-image {
    max-width: 100vw !important;
    max-height: 100vh !important;
    width: auto !important;
    height: auto !important;
  }
}

/* モバイル: ダウンロードボタンとGoodボタンを1行に */
@media (max-width: 768px) {
  .action-buttons {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    justify-content: space-between !important;
  }
  
  .action-buttons button {
    flex: 1 !important;
    padding: 10px 8px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
    min-width: 0 !important;
  }
  
  /* ボタンのテキストを調整 */
  #voteBtn {
    flex: 0.8 !important;
  }
  
  #downloadBtnPC,
  #downloadBtnPhone {
    flex: 1.1 !important;
  }
}

/* モバイル: ヘッダーのボタンをタイトルの下の行に配置 */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }
  
  .header-left {
    width: 100% !important;
    margin-bottom: 0 !important;
  }
  
  .header-actions {
    width: 100% !important;
    justify-content: space-around !important;
    padding: 8px 0 !important;
    gap: 6px !important;
  }
}

/* モバイル: スクロールボタンを画面端に配置 */
@media (max-width: 768px) {
  .scroll-left {
    margin-left: 0 !important;
    position: absolute;
    left: 5px;
    z-index: 100;
  }
  
  .scroll-right {
    margin-right: 0 !important;
    position: absolute;
    right: 5px;
    z-index: 100;
  }
  
  .tags-filter-bar {
    position: relative;
  }
}

/* モバイル: 画像詳細ページを通常表示 */
@media (max-width: 768px) {
  .detail-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: white !important;
    width: 100%;
    max-height: 80vh;  /* モバイルは80%の高さ */
    margin: 0 auto 30px;
    border-radius: 16px;
    overflow: hidden;
  }
  
  .detail-image {
    max-width: 100% !important;
    max-height: 80vh !important;  /* モバイルは80%の高さ */
    width: auto !important;
    height: auto !important;
    display: block;
    margin: 0 auto;
    object-fit: contain !important;  /* 全体表示 */
  }
}

/* ヘッダー折りたたみボタン（モバイルのみ） */
.header-toggle-btn {
  display: none; /* デフォルトは非表示 */
}

@media (max-width: 768px) {
  .header-toggle-btn {
    display: block;
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
  }
  
  .header-toggle-btn:hover {
    background: #5568d3;
    transform: scale(1.1);
  }
  
  .header-toggle-btn:active {
    transform: scale(0.95);
  }
  
  /* ヘッダーが折りたたまれた状態 */
  .header-collapsed .header-content {
    display: none;
  }
  
  .header-collapsed {
    padding: 0 !important;
    min-height: 0 !important;
  }
}

/* モバイル: ヘッダーとフィルターの間のスペースを削除 */
@media (max-width: 768px) {
  header {
    margin-bottom: 0 !important;
    padding-bottom: 10px !important;
  }
  
  .tags-filter-bar {
    top: auto !important;
    margin-top: 0 !important;
  }
}

/* モバイル: 折りたたみボタンを最前面に表示 */
@media (max-width: 768px) {
  .header-toggle-btn {
    z-index: 9999 !important;
    position: fixed !important;
    top: 10px !important;
    right: 10px !important;
    display: block !important;
  }
}

/* モバイル: 画像詳細ページを通常表示 */
@media (max-width: 768px) {
  .detail-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: white !important;
    width: 100%;
    max-height: 80vh;  /* モバイルは80%の高さ */
    margin: 0 auto 30px;
    padding: 20px !important;
    border-radius: 16px;
  }
  
  .detail-image {
    max-width: 100% !important;
    max-height: 80vh !important;  /* モバイルは80%の高さ */
    width: auto !important;
    height: auto !important;
    display: block;
    margin: 0;
    object-fit: contain;  /* 全体表示 */
    object-position: center;
  }
}

/* モバイル: 3行レイアウト / デスクトップ: 従来のレイアウト */
.mobile-button-layout {
  display: none; /* デフォルトは非表示 */
}

.desktop-button-layout {
  display: flex; /* デフォルトは表示 */
  justify-content: space-between;
  align-items: center;
}

@media (max-width: 768px) {
  /* モバイル: 3行レイアウトを表示 */
  .mobile-button-layout {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }
  
  .desktop-button-layout {
    display: none !important;
  }
  
  /* 各行のスタイル */
  .button-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 8px;
    width: 100%;
  }
  
  /* 1行目: ナビゲーション */
  .nav-row {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 8px;
  }
  
  .nav-row .nav-btn,
  .nav-row .nav-btn-back {
    flex: 1;
    padding: 10px;
    font-size: 14px;
    text-align: center;
  }
  
  /* 2行目: Good + ダウンロード */
  .download-row {
    gap: 6px;
  }
  
  .download-row button {
    flex: 1;
    padding: 10px 8px;
    font-size: 12px;
    white-space: nowrap;
  }
  
  .download-row .vote-btn {
    flex: 0.8;
  }
  
  /* 3行目: 共有 */
  .share-row {
    justify-content: space-around;
    gap: 12px;
  }
  
  .share-row .share-btn {
    flex: 1;
    max-width: 100px;
  }
}

/* 画像詳細ページの新しいレイアウト */
.detail-image-wrapper {
  position: relative;
  width: 100%;
  margin-bottom: 20px;
}

/* オーバーレイボタン（画像の上に配置） */
.overlay-btn {
  position: absolute;
  z-index: 10;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* カテゴリに戻るボタン（左上） */
.back-to-category-btn {
  top: 15px;
  left: 15px;
  background: #667eea;
  color: white;
  text-decoration: none;
  display: inline-block;
}

.back-to-category-btn:hover {
  background: #5568d3;
  transform: translateY(-2px);
}

/* Goodボタン（右上） */
.vote-btn-overlay {
  top: 15px;
  right: 15px;
  background: white;
  color: #333;
  border: 2px solid #e0e0e0;
  padding: 8px 12px !important;
  width: auto !important;
  min-width: 60px;
}

.vote-btn-overlay:hover {
  border-color: #667eea;
  transform: translateY(-2px);
}

/* ダウンロードと共有ボタンエリア */
.detail-actions-new {
  margin: 20px 0;
}

/* デスクトップ: ダウンロード + 共有 を同じ行 */
.desktop-download-share {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  position: relative;
}

.download-buttons-group {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.share-buttons-group {
  display: flex;
  gap: 10px;
  position: absolute;
  right: 0;
}

/* モバイル用レイアウト（デフォルトは非表示） */
.mobile-download-share {
  display: none;
}

/* モバイル: ダウンロード（1行目）+ 共有（2行目） */
@media (max-width: 768px) {
  .desktop-download-share {
    display: none !important;
  }
  
  .mobile-download-share {
    display: flex !important;
    flex-direction: column;
    gap: 15px;
  }
  
  .download-buttons-group-mobile {
    display: flex;
    gap: 8px;
    justify-content: center;
  }
  
  .download-buttons-group-mobile button {
    flex: 1;
    padding: 12px 10px;
    font-size: 13px;
  }
  
  .share-buttons-group-mobile {
    display: flex;
    justify-content: center;
    gap: 15px;
  }
  
  .share-buttons-group-mobile .share-btn {
    flex: 0;
    width: 48px;
    height: 48px;
  }
  
  /* オーバーレイボタンのモバイル調整 */
  .overlay-btn {
    padding: 8px 12px;
    font-size: 12px;
  }
  
  .back-to-category-btn {
    top: 10px;
    left: 10px;
  }
  
  .vote-btn-overlay {
    top: 10px;
    right: 10px;
  }
}

/* 関連画像セクション */
.related-images-section {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 2px solid #e0e0e0;
}

.related-images-section h3 {
  font-size: 24px;
  color: #333;
  margin-bottom: 20px;
  text-align: center;
}

/* 画像詳細ページのナビゲーションボタンを画像の左右端に配置 */
.detail-image-wrapper {
    position: relative;
}

.prev-btn-detail,
.next-btn-detail {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 50%;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.prev-btn-detail {
    left: 10px;
}

.next-btn-detail {
    right: 10px;
}

.prev-btn-detail:hover,
.next-btn-detail:hover {
    background: #667eea;
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.prev-btn-detail:active,
.next-btn-detail:active {
    transform: translateY(-50%) scale(0.95);
}

/* モバイルでのボタンサイズ調整 */
@media (max-width: 768px) {
    .prev-btn-detail,
    .next-btn-detail {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .prev-btn-detail {
        left: 5px;
    }
    
    .next-btn-detail {
        right: 5px;
    }
}

/* Google AdSense ad card styles */
.ad-card {
  background-color: #f8f8f8 !important;
  border: 2px dashed #ccc !important;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ad-card:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 12px rgba(0,0,0,0.25) !important;
}

.ad-card .ad-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Google AdSense ad card - Always visible outline */
.ad-card {
  position: relative;
}

.ad-card::before {
  content: 'AD';
  position: absolute;
  top: 5px;
  left: 5px;
  background: #ff9800;
  color: white;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: bold;
  z-index: 10;
  pointer-events: none;
}

.ad-card:hover {
  border-color: #f57c00 !important;
  box-shadow: 0 6px 16px rgba(255, 152, 0, 0.5) !important;
}

/* Ensure ad card borders are always visible */
.ad-card {
  border: 3px solid #ff9800 !important;
  box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4) !important;
}

/* ========================================
   Google AdSense Ad Card Styles
   トップページの広告カードを常に可視化
   ======================================== */

/* トップページの広告カード - 基本スタイル */
#categoriesContainer .ad-card,
.image-card.ad-card {
  position: relative !important;
  border: 3px solid #ff9800 !important;
  background-color: #f8f8f8 !important;
  box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4) !important;
  min-height: 200px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* "AD" バッジ - 左上に固定表示 */
#categoriesContainer .ad-card::before,
.image-card.ad-card::before {
  content: 'AD' !important;
  position: absolute !important;
  top: 5px !important;
  left: 5px !important;
  background: #ff9800 !important;
  color: white !important;
  padding: 3px 10px !important;
  border-radius: 4px !important;
  font-size: 11px !important;
  font-weight: bold !important;
  z-index: 100 !important;
  pointer-events: none !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

/* ホバー時の強調 */
#categoriesContainer .ad-card:hover,
.image-card.ad-card:hover {
  border-color: #f57c00 !important;
  box-shadow: 0 6px 16px rgba(255, 152, 0, 0.6) !important;
  transform: scale(1.02) !important;
}

/* 広告内のコンテンツエリア */
#categoriesContainer .ad-card > div,
.image-card.ad-card > div {
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
}

/* "Advertisement" テキスト */
#categoriesContainer .ad-card p,
.image-card.ad-card p {
  color: #999 !important;
  font-size: 11px !important;
  margin: 0 0 5px 0 !important;
  font-weight: 500 !important;
}

/* Hide footer on index page */
body.index-page footer {
  display: none !important;
}

/* ========================================
   Google AdSense Ad Card - FORCED VISIBILITY
   広告カードを確実に可視化（最優先）
   ======================================== */

/* 広告カード - 最強の優先度設定 */
body.index-page .image-card.ad-card,
body.index-page #categoriesContainer .ad-card,
.image-card.ad-card[id^="ad-card-"] {
  position: absolute !important;
  width: 200px !important;
  height: 200px !important;
  border: 3px solid #ff9800 !important;
  background-color: #f8f8f8 !important;
  box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4) !important;
  border-radius: 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  z-index: 5 !important;
}

/* AD バッジ - 最強の優先度 */
body.index-page .image-card.ad-card::before,
body.index-page #categoriesContainer .ad-card::before,
.image-card.ad-card[id^="ad-card-"]::before {
  content: 'AD' !important;
  position: absolute !important;
  top: 5px !important;
  left: 5px !important;
  background: #ff9800 !important;
  color: white !important;
  padding: 3px 10px !important;
  border-radius: 4px !important;
  font-size: 11px !important;
  font-weight: bold !important;
  z-index: 1000 !important;
  pointer-events: none !important;
  display: block !important;
}

/* ホバー時 */
body.index-page .image-card.ad-card:hover,
.image-card.ad-card[id^="ad-card-"]:hover {
  border-color: #f57c00 !important;
  box-shadow: 0 6px 16px rgba(255, 152, 0, 0.6) !important;
  transform: scale(1.02) !important;
}

/* ========================================
   CRITICAL FIX: Ad Card Visibility
   広告カードの強制可視化（最優先・最強ルール）
   ======================================== */

/* 広告カードは categoriesContainer の直下に配置されるため、
   category-section や image-grid の影響を受けないようにする */

/* 広告カード - 超強力セレクタ */
body.index-page #categoriesContainer > .image-card.ad-card,
body.index-page .image-card.ad-card[id^="ad-card-"],
#categoriesContainer > div.image-card.ad-card {
  position: absolute !important;
  width: 200px !important;
  height: 200px !important;
  border: 3px solid #ff9800 !important;
  background-color: #f8f8f8 !important;
  box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4) !important;
  border-radius: 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  z-index: 100 !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* AD バッジ - 超強力セレクタ */
body.index-page #categoriesContainer > .image-card.ad-card::before,
body.index-page .image-card.ad-card[id^="ad-card-"]::before,
#categoriesContainer > div.image-card.ad-card::before {
  content: 'AD' !important;
  position: absolute !important;
  top: 5px !important;
  left: 5px !important;
  background: #ff9800 !important;
  color: white !important;
  padding: 3px 10px !important;
  border-radius: 4px !important;
  font-size: 11px !important;
  font-weight: bold !important;
  z-index: 1000 !important;
  pointer-events: none !important;
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* ホバー時 */
body.index-page #categoriesContainer > .image-card.ad-card:hover,
body.index-page .image-card.ad-card[id^="ad-card-"]:hover {
  border-color: #f57c00 !important;
  box-shadow: 0 6px 16px rgba(255, 152, 0, 0.6) !important;
  transform: scale(1.02) !important;
}

/* 広告カード内のコンテンツ */
body.index-page .image-card.ad-card > div {
  opacity: 1 !important;
  visibility: visible !important;
  z-index: 10 !important;
}
