/* デザイントークン。ダークは [data-theme=dark]、nsfw ゾーンは既定ダーク (light 明示で上書き可) */
:root {
  --bg: #f4f5f7; --panel: #ffffff; --ink: #1c1e24; --sub: #5c6270;
  --line: #e2e4ea; --accent: #4066e0; --accent-ink: #ffffff;
  --visited: #8a5cb8; --sale: #d8433b; --shadow: rgba(20, 22, 30, .12);
  --cta: #5568b8; --cta-ink: #ffffff;
}
html[data-theme="dark"], html[data-zone="nsfw"]:not([data-theme="light"]) {
  --bg: #15161a; --panel: #1f2127; --ink: #e8e9ee; --sub: #9aa0ad;
  --line: #2c2f38; --accent: #6e8cf5; --accent-ink: #0e1015;
  --visited: #b08ad8; --sale: #f0655d; --shadow: rgba(0, 0, 0, .5);
  --cta: #5d6fa8; --cta-ink: #ffffff;
}
* { box-sizing: border-box }
/* display を持つ要素 (flex/grid) でも hidden 属性が必ず勝つように (age-gate 事象の一般化対策) */
[hidden] { display: none !important }
html { scroll-behavior: smooth }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.65 "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif; }
a { color: var(--accent); text-decoration: none }
a:hover { text-decoration: underline }

/* ---- topbar ---- */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--panel);
  border-bottom: 1px solid var(--line); box-shadow: 0 1px 6px var(--shadow); }
.topbar-inner { display: flex; align-items: center; gap: 14px; max-width: 1400px;
  margin: 0 auto; padding: 10px 16px; }
/* トップバーの構成要素は全て高さ 32px に統一 (検索・ボタン・バッジ) */
.brand { font-weight: 700; font-size: 20px; color: var(--ink); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px }
.brand:hover { text-decoration: none }
/* 塗りの赤はボタン (枠線のみ) より重く見えるため一回り小さく (26px、行中央揃え) */
.badge-18 { background: var(--sale); color: #fff; font-size: 10px; font-weight: 700;
  width: 26px; height: 26px; border-radius: 6px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  letter-spacing: -.02em }
/* main ではバッジ分のスペースを透明で確保 — ゾーン切替時に検索ボックスが動かない */
.badge-18.ghost { visibility: hidden }
/* トップバーのボタンは同寸の正方形 (32x32) — ゾーン切替で文字が変わっても動かない */
.btn-icon { border: 1px solid var(--line); background: none; color: var(--ink);
  border-radius: 6px; cursor: pointer; font-size: 14px; box-sizing: border-box;
  width: 32px; height: 32px; padding: 0; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center }
.zone-toggle { font-size: 12px; font-weight: 700; white-space: nowrap }
.zone-toggle:hover { text-decoration: none; border-color: var(--accent);
  color: var(--accent) }
.topnav { max-width: 1400px; margin: 0 auto; padding: 0 16px 8px; display: flex;
  gap: 4px 10px; flex-wrap: wrap; }
.nav-item { font-size: 12px; color: var(--sub); padding: 2px 8px; border-radius: 20px }
.nav-item.active { background: var(--accent); color: var(--accent-ink) }

/* ---- search ---- */
.search-open { display: none } /* モバイル専用 (991px 以下で表示) */
.searchbox { position: relative; flex: 1; max-width: 520px }
.searchbox input { width: 100%; height: 32px; padding: 0 12px; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg);
  color: var(--ink); font-size: 14px }
#search-panel { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 30px var(--shadow); max-height: 70vh; overflow: auto; padding: 10px }
.zero-title { color: var(--sub); font-size: 12px; margin-right: 8px }
.tag { display: inline-block; margin: 3px; padding: 3px 10px; border-radius: 20px;
  border: 1px solid var(--line); background: none; color: var(--accent);
  font-size: 12px; cursor: pointer }
.result { display: block; padding: 8px 10px; border-radius: 8px; color: var(--ink) }
.result:hover { background: var(--bg); text-decoration: none }
.result .cat { color: var(--sub); font-size: 11px; margin-left: 8px }
.result .d { color: var(--sub); font-size: 12px; display: block }
.no-hit { color: var(--sub); padding: 8px 10px }

/* ---- masonry (grid-auto-rows:1px + 事前計算 span = spans.css) ---- */
.masonry { max-width: 1400px; margin: 14px auto; padding: 0 16px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  grid-auto-flow: row dense; grid-auto-rows: 1px; column-gap: 8px; row-gap: 10px; }
.cat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; overflow: hidden; box-shadow: 0 1px 5px var(--shadow);
  transition: transform .3s cubic-bezier(.2, .6, .3, 1), box-shadow .3s }
@media (hover: hover) and (pointer: fine) {
  /* 面積が大きいのでカード (-5px) より控えめに浮かせる */
  .cat:hover { transform: translateY(-3px); box-shadow: 0 10px 24px var(--shadow) }
}
.cat-head h2 { font-size: 15px; margin: 0 0 4px; display: flex; align-items: center; gap: 8px }
.cat-head h2 a { color: var(--ink) }
.cat-head .count { font-size: 11px; color: var(--sub); background: var(--bg);
  border-radius: 10px; padding: 1px 8px }
.cat-desc { color: var(--sub); font-size: 12px; margin: 4px 0 }
.tagline { font-size: 12px; color: var(--sub); font-style: italic; margin: 6px 0 }
.cat-head { scroll-margin-top: 110px }

/* ---- scrollbox + 影 (スクロール可能の示唆) ---- */
.scrollwrap { position: relative }
.scrollwrap::before, .scrollwrap::after { content: ""; position: absolute; left: 0; right: 0;
  height: 14px; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .15s }
.scrollwrap::before { top: 0; background: linear-gradient(var(--shadow), transparent) }
.scrollwrap::after { bottom: 0; background: linear-gradient(transparent, var(--shadow)) }
.scrollwrap.top-shadow::before { opacity: 1 }
.scrollwrap.bottom-shadow::after { opacity: 1 }
.scrollbox { max-height: 320px; overflow-y: auto; margin: 0; padding: 0; list-style: none }
/* 罫線なしのフラットな行 (Apple 的な静けさ) */
.scrollbox li, .fulllist li { padding: 7px 4px }
/* トップのコンパクト行: 名前 + 詳しくボタンのみ (説明はホバー吹き出し) */
.scrollbox li { display: flex; align-items: center; gap: 6px; border-radius: 6px }
.scrollbox .site-link { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap }
/* 棚のサイトリンクは常にモノトーン (黒/白) — ホバーも訪問済みも色を変えない
   (Producer 裁定 2026-08-28。ホバーの手掛かりは下線と虫眼鏡の出現) */
.site-link { font-weight: 600; color: var(--ink) }
.site-desc { color: var(--sub); font-size: 12px }
/* 虫眼鏡は囲いなし。hover 環境では行に乗せた時だけ現れる (タッチでは常時表示) */
.detail-btn { display: inline-flex; align-items: center; justify-content: center;
  padding: 4px 7px; color: var(--sub); flex: 0 0 auto; border-radius: 4px }
.detail-btn svg { display: block }
.detail-btn:hover { color: var(--accent); text-decoration: none }
@media (hover: hover) and (pointer: fine) {
  .scrollbox li .detail-btn { opacity: 0; transition: opacity .12s }
  .scrollbox li:hover .detail-btn { opacity: 1 }
}
#tooltip { position: fixed; z-index: 200; max-width: 300px; background: var(--panel);
  color: var(--ink); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; font-size: 12px; line-height: 1.6;
  box-shadow: 0 8px 30px var(--shadow); pointer-events: none }
.sale { color: var(--sale); font-size: 11px; font-weight: 700; margin-left: 6px }
.fav { margin-right: 4px }

/* ---- 詳細ページ: 左=アドレスバー付き画像+ボタン2つ / 右=所見+良い悪い ----
   幅は本家実測に合わせる: コンテナ 1150px / 画像 460px / 文字 ~640px */
.page.review { max-width: 1150px }
.review-hero { display: grid; grid-template-columns: 460px 1fr;
  gap: 18px; margin: 14px 0 }
/* グリッド子は内容の最小幅で膨らませない (min-width:auto 対策 —
   スマホで hero-swipe が viewport を 660px に押し広げていた実測バグ) */
.review-left, .review-right { min-width: 0 }
.hero-swipe { max-width: 100% }
.review-right h1 { margin: 0 0 4px }
.hero-slide { display: none }
.hero-slide.current { display: block }
.site-frame { border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: var(--panel) }
.frame-bar { display: flex; align-items: center; gap: 6px; padding: 7px 12px;
  background: var(--bg); border-bottom: 1px solid var(--line); font-size: 13px }
.frame-bar a { color: var(--sub); font-weight: 600 }
.frame-bar a:hover { color: var(--accent) }
.hero-shot { display: block; overflow: hidden; position: relative }
.hero-shot img { display: block; width: 100%; aspect-ratio: 1200 / 760;
  object-fit: cover; transition: transform .25s }
.hero-shot:hover img { transform: scale(1.04) }
/* ホバー演出: 暗幕 + 外部リンク矢印 + 行き先ドメイン (本家の意匠。hover 環境のみ) */
.hero-go { position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  background: rgba(12, 14, 20, .55); color: #fff; opacity: 0; transition: opacity .15s }
.hero-go svg { width: 64px; height: 64px }
.hero-go-domain { font-size: 16px; font-weight: 700; letter-spacing: .02em }
@media (hover: hover) and (pointer: fine) {
  .hero-shot:hover .hero-go { opacity: 1 }
}
.hero-ph { display: flex; align-items: center; justify-content: center; gap: 8px;
  aspect-ratio: 1200 / 760; color: var(--sub); font-weight: 700; font-size: 18px;
  background: linear-gradient(135deg, var(--bg), var(--line)) }
/* 配置: 左=画像+ボタン+良い悪い / 右=本文が全高を使う (2026-08-28 裁定) */
.review-left { grid-column: 1; grid-row: 1 }
.review-hero > .proscons { grid-column: 1; grid-row: 2; margin: 0 }
.review-right { grid-column: 2; grid-row: 1 / 3 }
/* 左レールの縦リズム: レール内は均等 12px、評価カードの前だけ 24px (row-gap)。
   本家実測 (10/10/61) と同じ「グループ内は均等・節目だけ大きく」の思想 —
   ボタン間だけ詰める案 (8px) は A/B 実レンダ比較で不採用 (2026-08-29 裁定) */
.review-left .btn { display: block; width: 100%; text-align: center;
  box-sizing: border-box; margin: 12px 0 0;
  transition: transform .2s, box-shadow .2s }
@media (hover: hover) and (pointer: fine) {
  .review-left .btn:hover { transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--shadow) }
  .review-left .btn:active { transform: translateY(0);
    box-shadow: 0 2px 6px var(--shadow) }
}
/* 青の主ボタンは「開く」1つだけ。一覧へは静かな枠線 (.btn の塗りより強い詳細度で上書き) */
.btn.btn-list { background: var(--panel); border: 1px solid var(--line);
  color: var(--ink); font-weight: 600 }
.btn.btn-list:hover { border-color: var(--accent); color: var(--accent); filter: none }
.review-right .review-body { background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 18px; margin: 0 }
/* 評価は1枚のカード: 緑+ → 赤− (本家の likes/hates と同じ二重符号) */
.proscons { margin: 14px 0 }
.pc-list { list-style: none; margin: 4px 0; padding: 0 }
.pc-list li { display: flex; align-items: baseline; gap: 8px; padding: 4px 0 }
/* 丸バッジは目立ちすぎるため、色付きの記号そのものにする (2026-08-28 裁定) */
.pc-list li::before { flex: 0 0 auto; width: 1em; text-align: center; font-weight: 700 }
.pc-plus::before { content: "+"; color: #3f9d63 }
.pc-minus::before { content: "−"; color: var(--sale) }

/* ---- スクショカード (棚 / 関連): ホバーで「レビュー / サイトへ」の2択 ----
   Apple Store 風: ホバーでカードが浮き上がり影が深くなる */
.scard { min-width: 0; transition: transform .3s cubic-bezier(.2, .6, .3, 1) }
.scard-media { position: relative; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: var(--panel);
  box-shadow: 0 2px 8px var(--shadow); transition: box-shadow .3s }
@media (hover: hover) and (pointer: fine) {
  .scard:hover { transform: translateY(-5px) }
  .scard:hover .scard-media { box-shadow: 0 14px 30px var(--shadow) }
}
.scard-img { display: block; overflow: hidden }
.scard-img img { display: block; width: 100%; aspect-ratio: 1200 / 760;
  object-fit: cover; transition: transform .25s }
.scard-media:hover .scard-img img { transform: scale(1.06) }
.scard-media .hero-ph { font-size: 14px }
.scard-overlay { display: flex; flex-direction: column; gap: 8px; align-items: center;
  justify-content: center }
.btn-mini { display: block; width: 80%; text-align: center; padding: 8px 10px;
  border-radius: 7px; font-size: 13px; font-weight: 700 }
.btn-review { background: var(--panel); color: var(--ink); border: 1px solid var(--line) }
.btn-open { background: var(--cta); color: var(--cta-ink) }
.btn-mini:hover { text-decoration: none; filter: brightness(1.06) }
@media (hover: hover) and (pointer: fine) {
  .scard-overlay { position: absolute; inset: 0; background: rgba(12, 14, 20, .62);
    opacity: 0; transition: opacity .15s; pointer-events: none }
  .scard-media:hover .scard-overlay { opacity: 1; pointer-events: auto }
}
@media (hover: none) {
  .scard-overlay { flex-direction: row; padding: 8px 4px }
  .btn-mini { width: auto; flex: 1 1 0; padding: 7px 6px; font-size: 12px }
}
/* 名前は枠内 (画像下端のグラデーション帯、本家の意匠) */
.scard-shot { position: relative }
.scard-name { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  padding: 24px 10px 8px; font-weight: 700; font-size: 14px; color: #fff;
  background: linear-gradient(transparent, rgba(10, 12, 18, .78));
  display: flex; align-items: center; gap: 6px; pointer-events: none }
.scard-name a { color: #fff; pointer-events: auto }
.scard-name .num { color: rgba(255, 255, 255, .72); font-weight: 400; font-size: 13px }
.scard-desc { color: var(--sub); font-size: 12px; margin-top: 6px }
.related-grid, .card-grid { display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px 14px;
  margin: 12px 0 }

/* ---- 棚ページ: 左サイドバー / 中央カード / 右解説 (本家3カラム) ---- */
.page.shelf { max-width: 1150px }
.shelf-grid { display: grid; grid-template-columns: 240px 1fr 280px; gap: 18px;
  align-items: start }
.shelf-side { position: sticky; top: 76px }
.shelf-cat { display: block; padding: 8px 10px; border-radius: 8px; color: var(--ink);
  border: 1px solid transparent }
.shelf-cat:hover { text-decoration: none; background: var(--panel) }
.shelf-cat.active { background: var(--panel); border-color: var(--line); font-weight: 700 }
.shelf-cat-title { display: block; font-size: 13px }
.shelf-cat-favs { display: flex; align-items: center; gap: 3px; margin-top: 3px }
.shelf-cat-favs .count { margin-left: auto; font-size: 11px; color: var(--sub);
  background: var(--bg); border-radius: 10px; padding: 1px 7px }
.shelf-main .card-grid { grid-template-columns: repeat(2, 1fr) }
.shelf-intro { background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 16px; font-size: 13px }
.pc-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 16px }


/* ---- 下層ページ ---- */
.page { max-width: 860px; margin: 20px auto; padding: 0 16px }
.crumbs { font-size: 12px; color: var(--sub); margin-bottom: 10px }
.fulllist, .related { list-style: none; padding: 0 }
.domain { color: var(--sub) }
.btn { display: inline-block; background: var(--cta); color: var(--cta-ink);
  border: none; border-radius: 8px; padding: 10px 20px; font-size: 15px;
  font-weight: 700; cursor: pointer }
.btn:hover { text-decoration: none; filter: brightness(1.08) }
.btn-ghost { background: none; border: 1px solid var(--line); color: var(--ink) }
.btn-visit { margin: 12px 0 }
.review-body { background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 18px; margin: 14px 0 }

/* ---- footer / age gate ---- */
.footer { max-width: 1400px; margin: 30px auto; padding: 16px;
  border-top: 1px solid var(--line); color: var(--sub); font-size: 12px }
/* 規約系リンクは静かに (本文の邪魔をしない灰色・ホバーで色が付く) */
.foot-nav { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 6px }
.foot-nav a { color: var(--sub) }
.foot-nav a:hover { color: var(--ink) }

/* ---- 固定ページ (運営者情報・プライバシー) ---- */
.prose { line-height: 1.85 }
.prose h1 { font-size: 26px; margin: 8px 0 20px }
.prose h2 { font-size: 16px; margin: 28px 0 8px; padding-top: 16px;
  border-top: 1px solid var(--line) }
.prose h2:first-of-type { border-top: none; padding-top: 0 }
.prose p, .prose li { color: var(--ink) }
.prose ul { padding-left: 1.2em; margin: 8px 0 }
.prose li { margin: 6px 0 }
#age-gate { position: fixed; inset: 0; z-index: 100; background: rgba(10, 10, 14, .92);
  display: flex; align-items: center; justify-content: center; padding: 20px }
.age-box { background: var(--panel); border-radius: 12px; padding: 28px;
  max-width: 460px; text-align: center }
.age-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px;
  flex-wrap: wrap }
body.age-locked { overflow: hidden }

/* 揃えの基準線 (デスクトップ): タイトル行 = アドレスバー行 (37px)
   → 画像の上端と本文カードの上端が一直線。本文カードは右カラム全高に伸ばし
   左が長い時は下端も揃う (2026-08-28 裁定: 左右は行として対応させる) */
@media (min-width: 992px) {
  .review-right { display: flex; flex-direction: column }
  .review-right h1 { margin: 0; height: 37px; display: flex; align-items: center;
    font-size: 26px }
  .review-right .review-body { flex: 1 1 auto }
  /* 左レール: 行の自動分配が +/− カードを押し下げ、ボタンとの間に
     空白を作っていた (2026-08-29 実測)。row1=左の実高・row2=残り、
     カードは上詰めで密着させ、長文を読む間はスクロールに追従する */
  .review-hero { grid-template-rows: auto 1fr; row-gap: 24px }
  .review-hero > .proscons { align-self: start; position: sticky; top: 68px }
}

/* ---- レスポンシブ (本家同様 991px 一本) ---- */
@media (max-width: 991px) {
  .masonry { display: flex; flex-direction: column }
  .topnav { display: none }
  /* モバイル検索: 常設は虫眼鏡のみ、タップで全幅の検索が開く (本家方式) */
  .topbar-inner { position: relative }
  .searchbox { display: none }
  .search-open { display: inline-flex; margin-left: auto }
  .topbar.search-active .searchbox { display: block; position: absolute;
    left: 8px; right: 8px; top: 9px; z-index: 80; max-width: none }
  /* iOS は 16px 未満の入力にフォーカスすると自動ズームする → 16px で無効化 (はみ出しの正体) */
  .topbar.search-active .searchbox input { height: 36px; font-size: 16px }
  /* 詳細ページ: 画像トップ + 説明下。横スワイプで隣のサイトへ (site.js) */
  .review-hero { grid-template-columns: 1fr }
  .hero-swipe { display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
    gap: 10px; scrollbar-width: none; margin: 0 -16px; padding: 0 16px }
  .hero-swipe::-webkit-scrollbar { display: none }
  .hero-slide { display: block; flex: 0 0 100%; scroll-snap-align: center }
  .review-left, .review-right, .review-hero > .proscons { grid-area: auto }
  /* 一覧へボタンはパンくず・関連カードと重複するためスマホでは出さない。
     「サイトを開く」は明示 CTA としてスマホでも残す (収益の要 — 2026-08-28 裁定) */
  .review-left .btn-list { display: none }
  /* 棚ページ: サイドバーと解説を畳んで1カラム (カテゴリの行き来はトップが担う) */
  .shelf-grid { grid-template-columns: 1fr }
  .shelf-side { display: none }
  .shelf-intro { order: -1 }
  .shelf-main .card-grid { grid-template-columns: repeat(2, 1fr) }
}
@media (max-width: 576px) {
  .shelf-main .card-grid, .related-grid { grid-template-columns: 1fr }
}
