/* Fixed header offset */
body {
  padding-top: 64px; /* fallback; JSで実高に置換 */
}

@media (max-width: 767.98px) {
  body { padding-top: 56px; }
}
/* Ensure page content leaves room for mobile bottom ad and footer */
html, body {
  height: auto;
}

/* iOSなどのセーフエリア下端をCSS変数として公開（JSから参照するため） */
:root { --safe-area-bottom: env(safe-area-inset-bottom); }

/* Mobile bottom ad area is 100px fixed; add safe padding when present */
@media (max-width: 767.98px) {
  #tool-content-placeholder,
  main.container-fluid {
    padding-bottom: 120px; /* 控えめに */
  }
}
/* ===== 基本設定 ===== */
body {
  font-family: 'Noto Sans JP', sans-serif;
}

/* ===== Material Symbols Icons ===== */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}

/* ===== ツールナビゲーション ===== */
.tools-nav-container {
  max-height: 200px;
  overflow-y: auto;
  background: linear-gradient(to bottom, #ffffff, #f8f9fa);
}

#all-tools-nav a.badge {
  transition: all 0.2s ease;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
  font-weight: normal;
}

#all-tools-nav a.badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 通常のボタン: 薄い青 (Bootstrap btn-outline-primary の色) */
#all-tools-nav a.badge.bg-primary {
  background-color: #cfe2ff !important;
  color: #084298 !important;
  border: 1px solid #b6d4fe;
}

#all-tools-nav a.badge.bg-primary:hover {
  background-color: #0d6efd !important;
  color: white !important;
  border-color: #0d6efd;
}

/* 成功ボタン (Webカメラテスト): 薄い緑 */
#all-tools-nav a.badge.bg-success {
  background-color: #d1e7dd !important;
  color: #0f5132 !important;
  border: 1px solid #badbcc;
  font-weight: normal;
}

#all-tools-nav a.badge.bg-success:hover {
  background-color: #198754 !important;
  color: white !important;
  border-color: #198754;
  font-weight: bold;
}

/* 情報ボタン (プレイグラウンド): 薄いシアン */
#all-tools-nav a.badge.bg-info {
  background-color: #cff4fc !important;
  color: #055160 !important;
  border: 1px solid #b6effb;
}

#all-tools-nav a.badge.bg-info:hover {
  background-color: #0dcaf0 !important;
  color: black !important;
  border-color: #0dcaf0;
}

/* 警告ボタン: 薄い黄色 */
#all-tools-nav a.badge.bg-warning {
  background-color: #fff3cd !important;
  color: #664d03 !important;
  border: 1px solid #ffecb5;
}

#all-tools-nav a.badge.bg-warning:hover {
  background-color: #ffc107 !important;
  color: black !important;
  border-color: #ffc107;
}

/* 二次ボタン: 薄いグレー */
#all-tools-nav a.badge.bg-secondary {
  background-color: #e2e3e5 !important;
  color: #41464b !important;
  border: 1px solid #d3d4d5;
}

#all-tools-nav a.badge.bg-secondary:hover {
  background-color: #6c757d !important;
  color: white !important;
  border-color: #6c757d;
}

/* ===== PC表示時の広告枠の見た目を調整 (768px以上) ===== */
@media (min-width: 768px) {
  .ad-placeholder {
    height: 100%; /* 600px から 100% に変更 */
    background-color: #f8f9fa; /* bg-light */
    border: 1px dashed #ced4da; /* 少し薄い破線のボーダー */
    border-radius: 0.375rem; /* rounded */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd; /* text-mutedよりさらに薄く */
    font-size: 1.2rem;
    font-weight: bold;
    opacity: 0.6; /* 少し透明に */
  }
  
  /* サイドバー広告を上部に固定 (sticky) */
  #ad-sidebar-left,
  #ad-sidebar-right {
    position: sticky;
    top: 1rem;
    height: fit-content;
    max-height: calc(100vh - 2rem); /* 画面の高さいっぱい */
    overflow: visible; /* hidden から visible に変更 */
  }
  
  /* サイドバー広告内のAdSense広告の最小高さ設定 */
  #ad-sidebar-left .adsbygoogle,
  #ad-sidebar-right .adsbygoogle {
    min-height: 250px;
    width: 100%;
    display: block !important;
  }
}

/* ===== スマホ表示時の広告枠の見た目 ===== */
.ad-placeholder-mobile {
  height: 100px;
  background-color: #f8f9fa;
  border: 1px dashed #ced4da;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #adb5bd;
}

/* スマホのタイトル下広告（旧）/ 下部固定広告（新）の固定高さ（100px） */
#tool-mobile-ad-below-title,
#tool-mobile-ad-bottom {
  height: 100px;
  line-height: 0; /* iframe基準線による余白を排除 */
  overflow: hidden; /* 100px超のクリエイティブはクリップ */
}
.home-tools-list .list-group-item {
  padding-top: .75rem;
  padding-bottom: .75rem;
}
.home-tools-list .list-group-item a.fw-bold {
  font-size: 1rem;
  line-height: 1.25;
}
.home-tools-list .list-group-item .text-muted.small {
  line-height: 1.4;
}
#tool-mobile-ad-below-title .adsbygoogle,
#tool-mobile-ad-below-title .adsbygoogle iframe,
#tool-mobile-ad-bottom .adsbygoogle,
#tool-mobile-ad-bottom .adsbygoogle iframe {
  height: 100px !important;
  min-height: 100px !important;
  max-height: 100px !important;
  width: 100% !important;
  display: block !important;
}

/* ===== モバイル固定配置: フッター50px固定 + 広告100px固定 ===== */
@media (max-width: 767.98px) {
  /* フッターを常に画面下に固定（高さは可変：同意UIを含めて自然な高さに） */
  #footer-placeholder footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1020; /* 広告より下 */
  }
  /* モバイルではフッターブランドとナビを非表示（同意テキストのみ表示） */
  #footer-placeholder .brand-info,
  #footer-placeholder .footer-nav {
    display: none !important;
  }
  /* フッター内の余白をモバイル向けに圧縮 */
  #footer-placeholder footer .container {
    padding-top: 0.5rem;  /* 8px */
    padding-bottom: max(0.5rem, var(--safe-area-bottom));
    padding-left: 1rem;
    padding-right: 1rem;
  }
  /* 同意UIの上余白を詰める（固定高に収める） */
  #site-consent-area { margin-top: 0 !important; }
  #site-consent-area .form-check { gap: 0.5rem; }
  #site-consent-area .form-check-input { width: 1rem; height: 1rem; }
  #site-consent-area .form-check-label { font-size: .85rem; line-height: 1.2; }

  /* モバイル下部広告をフッターの上（下端から50px上）に固定配置 */
  #tool-mobile-ad-bottom {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--safe-area-bottom); /* JSでフッター高を加算して再配置 */
    height: 100px;
    background: #ffffff; /* 白背景で後ろのコンテンツを隠す */
    z-index: 1030; /* フッターより前面 */
    border-top: 1px solid #e0e0e0; /* 上部にボーダーを追加 */
  }

  /* メインコンテンツが広告/フッターに隠れないように余白を確保 */
  #main-content,
  .tool-content {
    /* JSが実測で上書きするためフォールバックのみ（!importantは付けない） */
    padding-bottom: calc(140px + var(--safe-area-bottom)); /* 広告100 + 予備40 */
  }
}

/* ===== 広告全停止時のフォールバック（data-ads-disabled を <html> に付与する場合想定） ===== */
html[data-ads-disabled="true"] .ad-placeholder-mobile { display: none !important; }

/* ===== フッター見切れ防止スペーサー ===== */
/* 各ツール本文の下に十分な余白を追加（スマホで説明枠がフッターに隠れないように） */
.tool-content { padding-bottom: 250px; } /* モバイル: 広告100px + フッター80px + 余白70px */
@media (min-width: 768px) { 
  .tool-content { padding-bottom: 150px; } /* PC: フッター60px + 余白90px */
  
  /* PC表示: フッターを画面下部に固定 */
  #footer-placeholder footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1020;
    background-color: #f8f9fa; /* フッターの背景色を確保 */
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1); /* 上部に影を追加 */
  }
  
  /* PC表示: メインコンテンツがフッターに隠れないように余白確保 */
  body {
    padding-bottom: 60px; /* フッター分の余白 */
  }
}

/* ===== AdSenseの描画フラッシュ抑止 =====
  デフォルトでは広告要素を非表示。JSがconfigを読み込んでenabled=trueのときだけ表示フラグを付与する。 */
.adsbygoogle { display: none !important; }
html[data-ads-enabled="true"] .adsbygoogle { display: block !important; }
/* モバイル下部広告コンテナは無効時に高さをゼロに（fixedは維持） */
html[data-ads-disabled="true"] #tool-mobile-ad-bottom { 
  height: 0 !important; 
  overflow: hidden;
}
/* 無効時はメインコンテンツの下余白を調整 */
@media (max-width: 767.98px) {
  html[data-ads-disabled="true"] #main-content,
  html[data-ads-disabled="true"] .tool-content { 
    padding-bottom: 72px !important; /* 56px(フッター)+余白16px */
  }
}