* { box-sizing: border-box; }

/* hidden属性は必ず最優先で非表示にする */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: #e9e9e9;
  font-family: "MS PGothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  color: #222;
  font-size: 15px;
  line-height: 1.7;
  overflow-x: hidden; /* サードパーティ広告ウィジェットが原因の横スクロール事故を防ぐ保険 */
}
html { overflow-x: hidden; }
a { color: #3b5998; }

/* ヘッダー(幅いっぱいのバナー画像) */
header.site-header {
  background: #3b5998;
  border-bottom: 4px solid #29406e;
  line-height: 0; /* 画像下の余白を消す */
}
.site-header__link { display: block; }
.site-header__banner {
  display: block;
  width: 59%;
  height: auto; /* 元画像の縦横比を保ったまま表示 */
  min-height: 60px; /* 画像未配置時に潰れて見えないための保険 */
  background: #3b5998; /* 読み込み中/未配置時の背景色 */
  margin: 0 auto; /* 中央寄せ */
}

/* 全体レイアウト */
.wrap {
  max-width: 1100px;
  margin: 16px auto;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.main { flex: 1; min-width: 0; }
.side { width: 220px; flex-shrink: 0; }

/* ===== トップページ:記事一覧 ===== */
.post-list { display: flex; flex-direction: column; gap: 14px; }

/* .post-card の見た目は「まとめサイト向けの追加パーツ」ブロックで定義しています
   (カードを <article> で包み、中の <a> をflexコンテナにする構成に変更したため) */

.post-thumb {
  width: 140px;
  height: 100px;
  flex-shrink: 0;
  background: #d8d8d8;
  border: 1px solid #bbb;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 12px;
  overflow: hidden;
}
.post-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.post-body { flex: 1; min-width: 0; }
.post-body h2 {
  margin: 0 0 6px;
  font-size: 17px;
  color: #1a1a1a;
}
.post-excerpt {
  font-size: 13px;
  color: #555;
  margin: 0 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-meta {
  font-size: 12px;
  color: #888;
}
.post-meta span { margin-right: 10px; }
.post-meta .count {
  background: #3b5998;
  color: #fff;
  padding: 1px 7px;
  font-size: 11px;
}

.pager {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 18px 0;
  font-size: 13px;
}
.pager a, .pager span {
  display: inline-block;
  padding: 5px 10px;
  background: #fff;
  border: 1px solid #ccc;
  text-decoration: none;
  color: #333;
}
.pager .current { background: #3b5998; color: #fff; border-color: #3b5998; }

/* ===== 記事詳細ページ ===== */
.article {
  background: #fff;
  border: 1px solid #ccc;
  margin-bottom: 16px;
  max-width: 100%;
  min-width: 0; /* flexアイテムが中身の最小幅で押し広げられるのを防ぐ */
}
.article-head { padding: 12px 14px; border-bottom: 1px solid #ddd; }
.article-head h1, .article-head h2 { margin: 0 0 6px; font-size: clamp(16px, 4.5vw, 19px); color: #1a1a1a; }
.meta { font-size: 12px; color: #888; display: flex; flex-wrap: wrap; gap: 4px 0; }
.meta span { margin-right: 10px; }

.lead { padding: 12px 14px; font-size: 14px; border-bottom: 1px dashed #ddd; }

.img-list { padding: 4px 14px 14px; box-sizing: border-box; max-width: 100%; min-width: 0; }
.img-item { padding: 18px 0; border-bottom: 1px solid #eee; max-width: 100%; min-width: 0; overflow: hidden; }
.img-item:last-child { border-bottom: none; }

.img-num {
  display: inline-block;
  background: #3b5998;
  color: #fff;
  font-weight: bold;
  font-size: 13px;
  padding: 2px 9px;
  margin-bottom: 8px;
}

/* プレースホルダー(画像未設定時)は4:3の箱で「画像を挿入」と表示 */
.img-frame--placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #d8d8d8;
  border: 1px solid #bbb;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 13px;
}

/* 実画像は切り抜かず、縦横比そのまま・横幅いっぱいで大きく表示 */
.img-frame--photo {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid #bbb;
  overflow: hidden;
  line-height: 0;
}
.img-frame--photo img {
  display: block;
  width: 100%;
  max-width: 100%; /* 万一widthの基準がずれても強制的にはみ出さないようにする保険 */
  height: auto;
}

.img-caption { font-size: 13px; color: #444; margin-top: 6px; }

.article-foot {
  padding: 10px 14px;
  font-size: 12px;
  color: #777;
  border-top: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
}

/* ===== 共有ボタン(アイコン) ===== */
.share { padding: 10px 14px 16px; display: flex; align-items: center; gap: 10px; }
.share span.share-label { font-size: 12px; color: #777; }
.share a.share-icon {
  display: inline-flex;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  transition: opacity 0.15s ease;
}
.share a.share-icon:hover { opacity: 0.75; }
.share a.share-icon img { width: 100%; height: 100%; display: block; }

/* ===== 広告枠 ===== */
.ad-slot {
  background: #f4f4f4;
  border: 1px dashed #bbb;
  color: #999;
  text-align: center;
  padding: 20px 10px;
  font-size: 12px;
  margin: 10px 14px;
}
#ad-status {
  background: #eef3ff;
  border: 1px solid #c6d4f0;
  color: #33507a;
  font-size: 12px;
  text-align: center;
  padding: 8px 10px;
  margin: 10px 14px;
}
#ad-prompt {
  text-align: center;
  margin: 10px 14px;
}
#ad-prompt button {
  background: #3b5998;
  color: #fff;
  border: none;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
}

/* ===== サイドバー ===== */
.box { background: #fff; border: 1px solid #ccc; margin-bottom: 16px; }
.box h3 { margin: 0; font-size: 13px; background: #3b5998; color: #fff; padding: 8px 10px; }
.box ul { list-style: none; margin: 0; padding: 0; }
.box li { border-bottom: 1px solid #eee; padding: 8px 10px; font-size: 12px; }
.box li:last-child { border-bottom: none; }
.box li a { color: #333; text-decoration: none; }
.box li a:hover { text-decoration: underline; }
.box li a.is-active { color: #3b5998; font-weight: bold; text-decoration: underline; }
.rank-num { display: inline-block; width: 16px; color: #3b5998; font-weight: bold; }

/* ===== フッター ===== */
footer.site-footer {
  background: #fff;
  border-top: 1px solid #ccc;
  margin-top: 16px;
  padding: 20px 16px 24px;
  text-align: center;
}
.footer-share {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}
.footer-share span.share-label { font-size: 12px; color: #777; }
.footer-share a.share-icon {
  display: inline-flex;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  transition: opacity 0.15s ease;
}
.footer-share a.share-icon:hover { opacity: 0.75; }
.footer-share a.share-icon img { width: 100%; height: 100%; display: block; }

.footer-links {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
  font-size: 12px;
}
.footer-links a { color: #555; text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

.footer-copy { font-size: 11px; color: #888; }


.empty-note {
  padding: 30px 14px;
  text-align: center;
  color: #999;
  font-size: 13px;
}

@media (max-width: 640px) {
  /* flex-direction:column にすると「幅」が交差軸になるため、.wrap の
     align-items:flex-start がそのまま効くと .main が中身の幅(fit-content)
     まで広がってしまう。stretch に戻して画面幅に合わせる。 */
  .wrap {
    flex-direction: column;
    align-items: stretch;
    padding: 0 10px;
  }
  .main { width: 100%; max-width: 100%; }
  .side { width: 100%; }
  .post-card__link { flex-direction: column; }
  .post-thumb { width: 100%; height: 160px; }

  /* スマホではバナーを画面幅いっぱいに。min-heightも外し、比率どおりの高さに委ねる */
  .site-header__banner {
    width: 100%;
    min-height: 0;
  }

  .ag-gate__card { padding: 28px 20px; }
  .ag-gate__card .ag-hero { margin: -28px -20px 16px; }
  .ag-btns { flex-direction: column; }

  .ad-reward__card { max-width: 100%; padding: 18px 14px; }
  .ad-reward__box { height: 110px; }

  .article-foot { flex-direction: column; gap: 6px; align-items: flex-start; }
}

@media (max-width: 380px) {
  /* header.site-header は画像がそのまま幅に追従するので個別調整は不要 */
  .ag-gate__card { padding: 22px 14px; }
  .ag-gate__card .ag-hero { margin: -22px -14px 14px; }
  .img-frame--placeholder { font-size: 12px; }
}

/* ============================================
   年齢確認ゲート(ag-agegate.js が制御)
   ============================================ */
#ag-gate {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #e9e9e9;
  opacity: 1;
  display: flex;
  flex-direction: column;
  z-index: 2000; /* 他のどの重なり要素よりも必ず手前に */
  transition: opacity 0.3s ease;
  overflow-y: auto;
}
#ag-gate.is-opening { opacity: 0; }

/* サイトのヘッダーを再現し、別ページに来たように見せる */
.ag-gate__header {
  background: #3b5998;
  border-bottom: 4px solid #29406e;
  flex-shrink: 0;
  line-height: 0;
}

.ag-gate__body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.ag-gate__card {
  background: #fff;
  max-width: 460px;
  width: 100%;
  padding: 40px 28px;
  text-align: center;
  border: 1px solid #ccc;
}
/* 年齢確認の画像。カードの内側余白を打ち消して左右いっぱいに出す。
   負のマージンの値は .ag-gate__card の padding と必ず対で調整すること。 */
.ag-gate__card .ag-hero {
  margin: -40px -28px 20px;
  line-height: 0;
}
.ag-gate__card .ag-hero img {
  display: block;
  width: 100%;
  height: auto; /* 画像本来の比率のまま。width/height属性があるので読み込み前もずれない */
}
.ag-gate__card h2 {
  margin: 0 0 14px;
  font-size: 20px;
  color: #1a1a1a;
}
.ag-gate__card p {
  font-size: 13px;
  color: #555;
  margin: 0 0 24px;
  line-height: 1.8;
}
.ag-gate__note {
  margin-top: 20px;
  font-size: 11px;
  color: #999;
  border-top: 1px solid #eee;
  padding-top: 16px;
}
.ag-btns { display: flex; gap: 10px; justify-content: center; }
.ag-btn {
  flex: 1;
  min-height: 44px; /* タップしやすい高さを確保 */
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #ccc;
  background: #f4f4f4;
  color: #333;
  cursor: pointer;
}
.ag-btn--solid { background: #3b5998; color: #fff; border-color: #3b5998; }
.ag-btn:focus-visible { outline: 2px solid #29406e; outline-offset: 2px; }

body.ag-locked { overflow: hidden; }

/* ============================================
   広告リワードモーダル(ad-control.js が制御)
   ============================================ */
#ad-reward {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.ad-reward__card {
  background: #fff;
  max-width: 320px;
  width: 100%;
  padding: 22px 18px;
  text-align: center;
  border: 1px solid #ccc;
}
.ad-reward__card h2 { margin: 0 0 10px; font-size: 15px; }
.ad-reward__box {
  background: #d8d8d8;
  border: 1px solid #bbb;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  cursor: pointer; /* 再生中はクリックで広告へ飛ぶことを示す */
}
.ad-reward__box .ad-instance,
.ad-reward__box .ad-instance img { max-width: 100%; max-height: 140px; }
.ad-reward__count { font-size: 13px; color: #555; margin-bottom: 12px; }
.ad-reward__card button {
  padding: 8px 16px;
  font-size: 13px;
  border: 1px solid #3b5998;
  background: #3b5998;
  color: #fff;
  cursor: pointer;
}
.ad-reward__card button:disabled {
  background: #ccc;
  border-color: #ccc;
  cursor: not-allowed;
}

/* ============================================
   広告プール(#ad-pool)
   document.write系ウィジェットをあらかじめ画面外で描画しておく置き場。
   display:none にすると幅・高さの計算ができずウィジェットのレイアウトが
   崩れるため、画面外に配置するだけにとどめる。
   ============================================ */
#ad-pool {
  position: fixed; /* absoluteだと後述の理由でページ全体の横幅を広げてしまうことがあるためfixedに変更 */
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.ad-slot--filled {
  background: none;
  border: none;
  padding: 0;
  display: flex;
  justify-content: center;
  max-width: 100%;
  overflow: hidden; /* 中の広告がどれだけ広がろうと、ここでページ幅への影響を断ち切る */
}
.ad-instance { max-width: 100%; }
.ad-instance--banner img { max-width: 100%; height: auto; }

/* ============================================
   DLsite広告ウィジェット自体の暴走対策

   html body div[id*=DLsite_blog_parts_00] ... という強い指定で
   幅が制御されていないため、それより確実に強い指定で
   横幅をこちら側で強制し、ページ全体の横スクロール事故を防ぐ。
   ============================================ */
html body div[id*="DLsite_blog_parts_00"],
html body div[id*="DLsite_blog_parts_00"] .DLsite_bp_body,
html body .DLsite_bp_body {
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
  overflow-x: auto !important; /* 中身が横に長い場合はウィジェット内だけでスクロールさせる */
}
html body div[id*="DLsite_blog_parts_00"] img {
  max-width: 100% !important;
  height: auto !important;
}

/* ============================================
   スクロール連動広告(scroll-ads.js が制御)
   ============================================ */
.scroll-ad {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 1200;
  display: flex;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.35s ease;
}
.scroll-ad.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* 20%スクロール: 画面ほぼいっぱいのインタースティシャル */
.scroll-ad--interstitial {
  top: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.scroll-ad--interstitial .scroll-ad__inner {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 4px;
  padding: 36px 16px 16px;
  display: flex;
  justify-content: center;
}

/* 50%スクロール: 画面下からせり上がるバー */
.scroll-ad--slideup {
  bottom: 0;
  justify-content: center;
  transform: translateY(100%);
}
.scroll-ad--slideup.is-visible { transform: translateY(0); }
.scroll-ad--slideup .scroll-ad__inner {
  position: relative;
  width: 100%;
  max-width: 720px;
  background: #fff;
  border-top: 1px solid #ccc;
  border-radius: 4px 4px 0 0;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
  padding: 30px 16px 16px;
  display: flex;
  justify-content: center;
}

.scroll-ad__close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  border: none;
  background: #333;
  color: #fff;
  border-radius: 50%;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.scroll-ad__close:hover { background: #555; }

.scroll-ad__slot { max-width: 100%; overflow: hidden; }

@media (max-width: 480px) {
  .scroll-ad--interstitial .scroll-ad__inner,
  .scroll-ad--slideup .scroll-ad__inner {
    padding-left: 8px;
    padding-right: 8px;
  }
}

/* ============================================
   まとめサイト向けの追加パーツ
   (パンくず / 見出し / 並び替えタブ / カード / タグ)
   ============================================ */

/* パンくず */
.breadcrumb {
  font-size: 12px;
  color: #777;
  margin-bottom: 10px;
}
.breadcrumb a { color: #3b5998; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb__sep { margin: 0 6px; color: #bbb; }

/* ページ見出し */
.page-title {
  margin: 0 0 10px;
  font-size: 18px;
  color: #1a1a1a;
  border-left: 5px solid #3b5998;
  padding-left: 9px;
  line-height: 1.4;
}
.page-title__count {
  font-size: 12px;
  font-weight: normal;
  color: #888;
  margin-left: 6px;
}

/* 並び替えタブ */
.sort-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  font-size: 12px;
}
.sort-tabs a {
  display: inline-block;
  padding: 5px 14px;
  background: #fff;
  border: 1px solid #ccc;
  color: #555;
  text-decoration: none;
}
.sort-tabs a.is-active {
  background: #3b5998;
  border-color: #3b5998;
  color: #fff;
  font-weight: bold;
}

/* カード(article要素でラップする形に変更) */
.post-card {
  background: #fff;
  border: 1px solid #ccc;
}
.post-card:hover { border-color: #3b5998; }
.post-card__link {
  display: flex;
  gap: 12px;
  padding: 12px;
  text-decoration: none;
  color: inherit;
}

/* サムネイル右下に枚数バッジを重ねる */
.post-thumb { position: relative; }
.post-thumb__empty { color: #999; font-size: 12px; }
.post-thumb__count {
  position: absolute;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 11px;
  line-height: 1.6;
  padding: 0 6px;
}

.badge-new {
  display: inline-block;
  background: #d33;
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  line-height: 1.6;
  padding: 0 5px;
  margin-right: 6px;
  vertical-align: 2px;
}

.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.post-meta span, .post-meta time { margin-right: 0; }
.post-views { color: #888; }
.post-cat {
  background: #eef1f8;
  border: 1px solid #ccd5e8;
  color: #3b5998;
  font-size: 11px;
  padding: 0 6px;
}

/* サイドバー見出しは h3 から h2 に変更したので、両方に効かせる */
.box h2, .box h3 {
  margin: 0;
  font-size: 13px;
  background: #3b5998;
  color: #fff;
  padding: 8px 10px;
}
.cat-count { color: #999; font-size: 11px; }
.box li a.is-active .cat-count { color: #7a92c4; }

/* タグクラウド */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f4f4f4;
  border: 1px solid #ddd;
  color: #555;
  font-size: 11px;
  padding: 3px 8px;
  text-decoration: none;
}
.tag:hover { border-color: #3b5998; color: #3b5998; }
.tag.is-active { background: #3b5998; border-color: #3b5998; color: #fff; }
.tag__count { color: #999; }
.tag.is-active .tag__count { color: #cbd6ec; }

.empty-inline { display: block; padding: 10px; color: #999; font-size: 12px; }

@media (max-width: 640px) {
  .page-title { font-size: 16px; }
}

/* ============================================
   前後の記事 / 関連まとめ / 固定ページ
   (build.js が出力するページで使います)
   ============================================ */

.prevnext {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.prevnext__item {
  flex: 1;
  background: #fff;
  border: 1px solid #ccc;
  padding: 10px 12px;
  text-decoration: none;
  color: #333;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.prevnext__item:hover { border-color: #3b5998; }
.prevnext__item--next { text-align: right; }
.prevnext__dir { font-size: 11px; color: #3b5998; font-weight: bold; }
.prevnext__title {
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related {
  background: #fff;
  border: 1px solid #ccc;
  margin-bottom: 16px;
}
.related__title {
  margin: 0;
  font-size: 13px;
  background: #3b5998;
  color: #fff;
  padding: 8px 10px;
}
.related__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 12px;
}
.related__item {
  text-decoration: none;
  color: #333;
  display: block;
  min-width: 0;
}
.related__thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #d8d8d8;
  border: 1px solid #bbb;
  overflow: hidden;
}
.related__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.related__label {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  margin-top: 5px;
  line-height: 1.5;
}
.related__item:hover .related__label { color: #3b5998; text-decoration: underline; }

.static-page {
  background: #fff;
  border: 1px solid #ccc;
  padding: 16px 18px;
  font-size: 14px;
}
.static-page h2 {
  font-size: 15px;
  margin: 22px 0 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid #eee;
}
.static-page h2:first-child { margin-top: 0; }
.static-page p { margin: 0 0 12px; }

.article-views { color: #888; }

@media (max-width: 640px) {
  .related__grid { grid-template-columns: repeat(2, 1fr); }
  .prevnext { flex-direction: column; }
  .prevnext__item--next { text-align: left; }
}

/* ============================================
   広告非表示ボタン(画像)
   #ad-prompt button の色・余白指定を打ち消して、
   画像そのものをボタンにする。
   ============================================ */
#ad-prompt button.ad-reward-btn {
  background: none;
  border: none;
  padding: 0;
  display: inline-block;
  width: 100%;
  max-width: 420px;   /* PCで大きくなりすぎないように */
  line-height: 0;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
#ad-prompt button.ad-reward-btn:hover { opacity: 0.85; }
#ad-prompt button.ad-reward-btn:active { transform: scale(0.98); }
#ad-prompt button.ad-reward-btn:focus-visible {
  outline: 2px solid #3b5998;
  outline-offset: 3px;
}
#ad-prompt button.ad-reward-btn img {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 640px) {
  /* スマホでは画面幅に対して素直に伸ばす */
  #ad-prompt button.ad-reward-btn { max-width: 100%; }
}

/* ============================================
   画像のタップ拡大(site.js の Lightbox が制御)
   ============================================ */

.img-frame--photo img.is-zoomable { cursor: zoom-in; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000; /* 年齢確認ゲート(2000)より手前 */
  background: rgba(0, 0, 0, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 44px 12px;
  cursor: zoom-out;
  touch-action: pan-y; /* 横スワイプは自前で処理する */
}
.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox__close {
  position: absolute;
  top: 8px;
  right: 10px;
  /* 広告面(z-index:3)よりさらに手前。広告が出ていても必ず閉じられるようにする。
     出口のない全画面広告は利用者に嫌われるうえ、検索評価も下げます。 */
  z-index: 4;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.lightbox__close:hover { background: rgba(255, 255, 255, 0.3); }

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 46px;
  height: 76px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
}
.lightbox__nav:hover { background: rgba(255, 255, 255, 0.28); }
.lightbox__nav--prev { left: 0; border-radius: 0 6px 6px 0; }
.lightbox__nav--next { right: 0; border-radius: 6px 0 0 6px; }

.lightbox__counter {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: #fff;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.55);
  padding: 3px 12px;
  border-radius: 12px;
  pointer-events: none;
}

/* めくっている途中で挟まる広告 */
.lightbox__ad {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.lightbox__ad-card {
  background: #fff;
  border-radius: 4px;
  padding: 16px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  text-align: center;
}
.lightbox__ad-slot {
  display: flex;
  justify-content: center;
  max-width: 100%;
  overflow: hidden;
  margin-bottom: 14px;
}
.lightbox__ad-close {
  background: #3b5998;
  color: #fff;
  border: none;
  padding: 10px 20px;
  font-size: 13px;
  min-height: 44px;
  cursor: pointer;
  border-radius: 3px;
}
.lightbox__ad-close:hover { background: #2f4a80; }

@media (max-width: 640px) {
  /* スマホでは矢印ボタンを小さくして画像の邪魔をしないようにする */
  .lightbox__nav { width: 34px; height: 60px; font-size: 24px; }
  .lightbox__stage { padding: 44px 4px; }
}
