/* 口コミのランキングのページの見た目。 trend/site.py が assets/style.css として書き出す。
   色は :root にまとめ、 スマホのダークモードでは下の @media で入れ替える。 Web フォントは使わない (重いため)。
   画面の幅に合わせて形を変える (レスポンシブ):
     〜599px  スマホ: 上の横に流せるジャンルの札・表は 1 列・画像と文字のカード、 ボタンはその下
     600px〜  タブレット: 1 行に並ぶ薄いカード (ボタンは右)
     1024px〜 パソコン: 左にジャンルの一覧・表は 2 列 (トップは増加数と増加率を左右に)
   JavaScript は assets/side.js だけ (ジャンルの一覧の動き。 無くても読める)。 トップへ戻るボタンは CSS だけ。 */
:root {
  --bg: #f6f6f3;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #5b616b;
  --line: #e4e4df;
  --btn-text: #9a3412;        /* 楽天で見る: 塗りつぶさず、 線と文字だけの落ち着いた色 (楽天の赤 #bf0000 に似せない) */
  --btn-line: #e0b49b;        /* カードの枠に合わせて 2px・少し濃く (10-21 依頼者) */
  --btn-hover: #fdf1ea;
  --tag-bg: #e8eefc;          /* ジャンルの札 */
  --tag-text: #1d4ed8;
  --up-bg: #e3f6e9;
  --up-text: #15803d;
  --rate-bg: #ede9fe;
  --rate-text: #6d28d9;
  --down: #b91c1c;
  --new: #9a3412;
  --star: #b7791f;
  --gold: #d4a017;
  --silver: #8c949e;
  --bronze: #b4692f;
  --sample-bg: #fff4d6;
  --shadow: 0 1px 2px rgb(0 0 0 / .06);
  --item-bg: #fdf6e3;         /* 商品カード: 白より目が疲れにくい Solarized Light の背景 base3 (10-21 依頼者) */
  --item-line: #d9ceac;      /* 枠は 2px で、 base2 (#eee8d5) より濃くして際立たせる (10-21 依頼者) */
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121417;
    --card: #1c1f24;
    --item-bg: #1c1f24;
    --item-line: #2c3036;
    --text: #e8eaed;
    --muted: #a3a9b3;
    --line: #2c3036;
    --btn-text: #f4a77e;
    --btn-line: #5a3a2a;
    --btn-hover: #2a1f19;
    --tag-bg: #1e2a4a;
    --tag-text: #93b4ff;
    --up-bg: #12351f;
    --up-text: #6ee79a;
    --rate-bg: #2e1f5e;
    --rate-text: #c4b5fd;
    --down: #f87171;
    --new: #f4a77e;
    --star: #f5b942;
    --sample-bg: #3a2f12;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 112px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.7;
}
a { color: inherit; }
a:focus-visible { outline: 2px solid var(--tag-text); outline-offset: 2px; border-radius: 6px; }

/* 上に貼り付く帯とジャンルの札 (スマホ・タブレット) */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar { max-width: 1400px; margin: 0 auto; padding: 8px 16px 4px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 16px; }
.logo { display: block; line-height: 0; }
.logo img { height: 40px; width: auto; }
/* スマホ・タブレットのジャンルの選び方: 左端の「≡ ジャンル」で一覧を開く + 横になぞる札の列 (10-21) */
.chips-row { position: relative; display: flex; align-items: center; padding: 4px 0 8px 16px; }
.chips {
  flex: 1; min-width: 0; padding: 0 16px 0 8px; scroll-padding-inline: 8px;
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
}
.gmenu { flex: none; }
.gmenu summary {
  list-style: none; cursor: pointer; min-height: 28px; display: inline-flex; align-items: center; padding: 0 10px;
  border-radius: 999px; border: 1.5px solid var(--text); background: var(--card); font-size: 11.5px; font-weight: bold; white-space: nowrap;
}
.gmenu summary::-webkit-details-marker { display: none; }
.gmenu .gm-close, .gmenu[open] .gm-open { display: none; }
.gmenu[open] .gm-close { display: inline; }
.gmenu-list {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 30; max-height: 70vh; overflow-y: auto;
  padding: 10px 16px 16px; background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: 0 8px 16px rgb(0 0 0 / .12);
}
.gmenu-list ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.gmenu-list a {
  display: flex; align-items: center; min-height: 44px; padding: 4px 10px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--line); text-decoration: none; font-size: 13px; line-height: 1.35;
}
.gmenu-list a[aria-current="page"] { background: var(--text); color: var(--bg); font-weight: bold; }
.gmenu-list a[class^="g-"][aria-current="page"] { background: var(--g-bg); color: var(--g-text); border-color: var(--g-dot); }
.chips::-webkit-scrollbar { display: none; }
.chips a {
  flex: none; scroll-snap-align: start;
  min-height: 28px; display: inline-flex; align-items: center;   /* 小さめ (10-21 依頼者。 押しやすさの最低 24px は満たす) */
  padding: 0 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); text-decoration: none; font-size: 11.5px; white-space: nowrap;
}
.chips a[class^="g-"]::before, .side a[class^="g-"]::before, .gmenu-list a[class^="g-"]::before {     /* ジャンルの色の丸印 (表の中の札と同じ色) */
  content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--g-dot); margin-right: 6px;
}
.chips a[aria-current="page"] { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: bold; }
.chips a[class^="g-"][aria-current="page"] { background: var(--g-bg); color: var(--g-text); border-color: var(--g-dot); }

/* 左のジャンルの一覧 (パソコンだけ) */
.side { display: none; }

.layout { max-width: 880px; margin: 0 auto; }
main { padding: 16px; min-width: 0; }
.sample { background: var(--sample-bg); border-radius: 12px; padding: 10px 14px; margin: 0 0 10px; font-weight: bold; font-size: 14px; }
/* 広告の表記: 上の帯の右にいつも出す (消さない)。 威圧感が出ないよう、 小さく・細く・灰色に (10-21 依頼者) */
.ad { margin: 0; display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.pr { border: 1px solid var(--muted); border-radius: 4px; padding: 0 4px; font-size: 10px; line-height: 1.5; letter-spacing: .05em; }
.crumbs { font-size: 14px; color: var(--muted); margin: 0 0 6px; }
h1 { font-size: 24px; line-height: 1.4; margin: 6px 0; }
h1.hero { margin: 0 0 8px; line-height: 0; }
.hero img { width: 100%; height: auto; display: block; border-radius: 20px; }
/* 集計日などの案内 (パソコンは左のメニューの下、 スマホはページの下) */
/* 項目名の下に値 (集計日時は「2026年10月21日 2時台」と長いので、 横に並べると折り返して読みにくい) */
.site-info { display: grid; grid-template-columns: 1fr; margin: 0; font-size: 11.5px; color: var(--muted); }
.site-info dt { font-weight: bold; }
.site-info dd { margin: 0 0 4px; white-space: nowrap; }
.info-mobile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin: 16px 0 0; }
.meta { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.lead { margin: 0 0 12px; }

/* 目次 (押すと、 その表へ飛ぶ。 パソコンでは表が並んで見えるので出さない) */
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 4px; }
.toc a {
  min-height: 28px; display: inline-flex; align-items: center; padding: 0 10px;
  border-radius: 999px; background: var(--card); border: 1px solid var(--line);
  text-decoration: none; font-size: 11.5px; font-weight: bold;
}

/* TOP10 / TOP20 の切り替え (表の右上)。 11 位からと見出しの「TOP20」は、 TOP20 を選んだときだけ見せる (2026-10-22 依頼者) */
.topn { display: flex; justify-content: flex-end; margin: 8px 0 -6px; }
.topn input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.topn label {
  min-height: 30px; display: inline-flex; align-items: center; padding: 0 14px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: bold;
}
.topn label:first-of-type { border-radius: 999px 0 0 999px; }
.topn label:last-of-type { border-radius: 0 999px 999px 0; border-left: none; }
.topn input:checked + label { background: var(--text); color: var(--bg); border-color: var(--text); }
.topn input:focus-visible + label { outline: 2px solid var(--tag-text); outline-offset: 2px; }
.card.more, .n-all { display: none; }
body:has(#topn-all:checked) .card.more { display: grid; }
body:has(#topn-all:checked) .n-all { display: inline; }
body:has(#topn-all:checked) .n-first { display: none; }

.ranking { margin: 16px 0; min-width: 0; }
.ranking h2 { font-size: 15px; margin: 0; line-height: 1.4; }
/* 表の見出し: 表ごとに色とアイコン (増加数 = 緑 / 増加率 = 紫 / 売れている順 = オレンジ / 口コミ件数 = 青) */
.sec-head { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; padding: 6px 12px; border-radius: 10px; border-left: 4px solid; background: var(--card); }
.sec-head img { flex: none; width: 28px; height: 28px; }
.sec-head .note { margin: 0; }
.sec-count { border-color: #15803d; background: color-mix(in srgb, var(--up-bg) 55%, var(--card)); }
.sec-count h2 { color: var(--up-text); }
.sec-rate { border-color: #6d28d9; background: color-mix(in srgb, var(--rate-bg) 55%, var(--card)); }
.sec-rate h2 { color: var(--rate-text); }
.sec-sales { border-color: #c2410c; background: color-mix(in srgb, #ffedd5 45%, var(--card)); }
.sec-total { border-color: #1d4ed8; background: color-mix(in srgb, #e0e7ff 45%, var(--card)); }
.note { color: var(--muted); font-size: 12px; margin: 0 0 8px; }
.empty { background: var(--card); border-radius: 12px; padding: 20px; color: var(--muted); text-align: center; }

/* 商品カード (スマホ: 画像と文字を横に、 ボタンは下) */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.card {
  display: grid; grid-template-columns: 64px 1fr; gap: 3px 10px; align-items: start;
  grid-template-areas: "thumb genre" "thumb name" "thumb metric" "thumb facts" "buy buy";
  background: var(--item-bg); border-radius: 12px; padding: 10px; box-shadow: var(--shadow);
  border: 2px solid var(--item-line);
}
.row2 { display: contents; }   /* スマホ: 中の札と価格の行は、 カードの決まった場所 (genre・facts) に置く */
.thumb { grid-area: thumb; position: relative; width: 64px; height: 64px; }
.thumb img, .noimg { width: 100%; height: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 10px; background: #fff; display: block; }
.rank {
  position: absolute; top: -6px; left: -6px;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; font-weight: bold; font-size: 12px;
  background: var(--card); color: var(--text); border: 2px solid var(--line);
}
.rank.gold { background: var(--gold); color: #fff; border-color: var(--gold); }
.rank.silver { background: var(--silver); color: #fff; border-color: var(--silver); }
.rank.bronze { background: var(--bronze); color: #fff; border-color: var(--bronze); }
.genre {
  grid-area: genre; justify-self: start;
  display: inline-flex; align-items: center; min-height: 22px; margin: 0; padding: 0 8px;
  border-radius: 999px; background: var(--g-bg, var(--tag-bg)); color: var(--g-text, var(--tag-text));
  border: 2px solid color-mix(in srgb, var(--g-dot, var(--tag-text)) 45%, var(--g-bg, var(--tag-bg)));   /* ボタンに合わせて 2px (10-21) */
  font-size: 11px; font-weight: bold; text-decoration: none; white-space: nowrap;
}
.genre::after { content: "›"; margin-left: 6px; }
.name {
  grid-area: name; min-width: 0;
  font-size: 13px; line-height: 1.5; margin: 0; font-weight: normal;   /* 太字にしない (10-21 依頼者) */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.metric { grid-area: metric; margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.badge-up, .badge-total {
  font-size: 13px; font-weight: bold; font-variant-numeric: tabular-nums;   /* 小さく・背景なし (10-21 依頼者) */
}
.badge-up { color: var(--up-text); }
.badge-rate { color: var(--rate-text); font-size: 13px; font-weight: bold; font-variant-numeric: tabular-nums; }
.move { font-size: 13px; font-weight: bold; font-variant-numeric: tabular-nums; }
.move.up { color: var(--up-text); }
.move.down { color: var(--down); }
.move.same { color: var(--muted); }
.move.new { color: var(--new); }
.sub { color: var(--muted); font-size: 11px; white-space: nowrap; }
.facts { grid-area: facts; margin: 0; font-size: 12px; display: flex; flex-wrap: wrap; gap: 0 10px; color: var(--muted); }
.stars { color: var(--star); font-weight: bold; white-space: nowrap; }
.count { color: var(--muted); font-weight: normal; }
.price { color: var(--text); font-weight: bold; font-variant-numeric: tabular-nums; }
.buy {
  grid-area: buy; margin-top: 6px;
  min-height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 999px; border: 2px solid var(--btn-line); background: transparent; color: var(--btn-text);
  text-decoration: none; font-size: 13px; font-weight: bold;
}
@media (hover: hover) {
  .buy:hover { background: var(--btn-hover); }
  .genre:hover { text-decoration: underline; }
}

/* トップへ戻る (下へスクロールすると右下に出る。 対応していないブラウザでは、 いつも出しておく)
   行き先の「#top」は、 わざと id を付けない (HTML の決まりで、 ページの一番上へ戻る)。
   上にくっつくヘッダーに id="top" を付けると、 「もう見えている」とされて戻らない (10-22 依頼者「効きが悪い」) */
.totop {
  position: fixed; right: 16px; bottom: 16px; z-index: 20;
  min-height: 36px; display: inline-flex; align-items: center; padding: 0 14px;
  border-radius: 999px; background: var(--card); color: var(--text); border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgb(0 0 0 / .12); text-decoration: none; font-size: 12.5px; font-weight: bold;
}
@supports (animation-timeline: scroll()) {
  .totop { animation: totop-show linear both; animation-timeline: scroll(root); animation-range: 0 400px; }
  @keyframes totop-show { from { opacity: 0; visibility: hidden; } to { opacity: 1; visibility: visible; } }
}

/* このサイトについて */
/* このサイトについて: 文は小さめ (10-22 依頼者「もっと小さくても良い」) */
.doc { background: var(--card); border-radius: 14px; padding: 4px 18px 8px; margin: 16px 0; border: 1px solid var(--line); font-size: 13px; line-height: 1.8; }
.doc h2 { font-size: 16px; }

.caution { color: var(--muted); font-size: 13px; }
/* ページの下: 横幅いっぱいの濃い色の帯 (左にロゴと紹介文、 右に項目ごとのリンク、 一番下に楽天の表記と著作権表示) */
.foot { margin-top: 32px; background: #1e2430; color: #c9ced6; font-size: 12px; }   /* 下の帯は控えめに (10-21 依頼者) */
.foot-in { max-width: 1400px; margin: 0 auto; padding: 20px 16px 6px; display: grid; gap: 18px; grid-template-columns: 1fr; }
.foot-brand img { height: 28px; width: auto; display: block; }
.foot-brand p { margin: 6px 0 0; color: #9aa3af; font-size: 11.5px; }
.foot-sns a { display: inline-flex; align-items: center; min-height: 26px; color: #c9ced6; text-decoration: none; }   /* 運営者の Threads */
.foot-sns a:hover { color: #ffffff; text-decoration: underline; }
.foot-h { margin: 0 0 4px; color: #ffffff; font-weight: bold; font-size: 12px; }
.foot-col ul { list-style: none; margin: 0; padding: 0; }
.foot-col a { display: inline-flex; align-items: center; min-height: 26px; color: #c9ced6; text-decoration: none; }
.foot-col a:hover { color: #ffffff; text-decoration: underline; }
.foot-genres ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 14px; }
.foot-genres a { white-space: nowrap; }
.foot-genres a[aria-current="page"] { color: #ffffff; font-weight: bold; }
.foot-genres a::before { content: none; }
.foot-bottom {
  max-width: 1400px; margin: 0 auto; padding: 14px 16px 80px; border-top: 1px solid #343b49;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; font-size: 12px; color: #9aa3af;
}
.foot-bottom p { margin: 0; }
.credit a { color: #9aa3af; }
@media (min-width: 760px) {
  .foot-in { grid-template-columns: 1.2fr 1fr 2fr; }
}

/* タブレット以上: 1 行に並ぶ薄いカード (画像 | 名前 3 行まで / 価格 | ボタン・札・数字) */
@media (min-width: 600px) {
  .card {
    /* 右の列は「楽天で見る」・ジャンルの札・数字 (小さく、 背景なし)。 商品名を広く見せる (10-21 依頼者) */
    grid-template-columns: 52px minmax(0, 1fr) 150px; align-items: center; padding: 8px 12px; gap: 4px 10px;
    border-radius: 12px;
    grid-template-areas: "thumb name buy" "thumb name genre" "thumb facts metric";
    min-height: 92px;   /* カードの高さをそろえる (商品名は 3 行分の高さを取る) */
  }
  .cards { gap: 6px; }
  .gmenu-list ul { grid-template-columns: repeat(3, 1fr); }
  .thumb { width: 52px; height: 52px; }
  .rank { width: 22px; height: 22px; font-size: 11px; top: -6px; left: -6px; }
  .genre {
    min-height: 24px; padding: 0 8px; font-size: 11px; margin: 0; justify-self: stretch; justify-content: center;
    overflow: hidden; text-overflow: ellipsis; display: block; line-height: 24px; text-align: center;
  }
  .name { align-self: start; margin: 0; font-size: 12.5px; line-height: 1.5; -webkit-line-clamp: 3; height: 4.5em; }   /* 3 行分 (短い名前でも高さをそろえる)。 字で圧迫しないよう小さめ (10-21) */
  /* ジャンルのページ (札がない): ボタンは商品名の高さの真ん中、 数字は価格の行にそろえる (10-21 依頼者) */
  .card:not(:has(.genre)) { grid-template-areas: "thumb name buy" "thumb name buy" "thumb facts metric"; }
  .card:not(:has(.genre)) .buy { align-self: center; }
  .facts { flex-wrap: nowrap; white-space: nowrap; }
  .sub.period { display: none; }
  .metric { margin: 0; flex-wrap: nowrap; justify-content: center; gap: 0 6px; white-space: nowrap; }
  .facts { align-self: center; }
  .badge-up, .badge-total, .badge-rate { font-size: 12px; background: none; padding: 0; }
  .metric .sub { font-size: 11px; }
  .move { font-size: 12px; }
  .facts { font-size: 12px; }
  .buy { margin: 0; min-height: 32px; padding: 0 8px; font-size: 12px; white-space: nowrap; justify-self: stretch; }
}

/* パソコン: 左にジャンルの一覧、 表は 2 列 */
@media (min-width: 1024px) {
  html { scroll-padding-top: 72px; }
  .chips-row { display: none; }
  /* 左の一覧は、 いちばん長いジャンル名 (14 文字) とスクロールバーが並んでも 1 行に収まる幅 (10-21 依頼者) */
  .layout { max-width: 1400px; display: grid; grid-template-columns: 224px 1fr; gap: 8px; padding: 0 16px; }
  main { padding: 12px 0; }
  .side { display: block; }
  /* 左の列: ジャンルの一覧は上、 集計日などは画面の下に貼り付ける */
  .side-in { position: sticky; top: 64px; height: calc(100vh - 64px); display: flex; flex-direction: column; padding: 12px 8px 12px 0; }
  .side-in nav { overflow-y: auto; min-height: 0; scrollbar-gutter: stable; }
  .side .site-info { margin: auto 0 0 10px; padding-top: 12px; border-top: 1px solid var(--line); }
  .info-mobile { display: none; }
  .side ul { list-style: none; margin: 0; padding: 0; }
  .side a { display: flex; align-items: center; padding: 2px 8px; border-radius: 8px; text-decoration: none; font-size: 11.5px; line-height: 1.5; }   /* 小さめ (10-21 依頼者) */
  .side a:hover { background: var(--card); }
  .side a[aria-current="page"] { background: var(--text); color: var(--bg); font-weight: bold; }
  .side a[class^="g-"][aria-current="page"] { background: var(--g-bg); color: var(--g-text); box-shadow: inset 3px 0 0 var(--g-dot); }
  /* 一覧を下へ送ったときだけ出る「一覧の先頭へ」 (side.js が出し入れする) */
  .side-top {
    position: sticky; bottom: 0; width: 100%; margin-top: 6px; min-height: 36px; border-radius: 8px;
    border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: 13px;
    cursor: pointer; box-shadow: 0 -2px 8px rgb(0 0 0 / .06);
  }
  .side-top:hover { background: var(--bg); }
  .side-top[hidden] { display: none; }
  .toc { display: none; }
  h1 { font-size: 22px; margin: 4px 0; }
  .lead { margin: 0 0 4px; }
  .tables { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; align-items: start; }
  .ranking { margin: 14px 0; }
  /* 表の見出しは控えめに (10-21 依頼者「もっと小さくていい」) */
  .ranking h2 { font-size: 15px; }
  .note { font-size: 12px; margin: 0 0 6px; }
  .sec-head { gap: 10px; padding: 6px 12px; border-left-width: 4px; border-radius: 10px; margin: 0 0 8px; }
  .sec-head img { width: 28px; height: 28px; }
  .card { transition: box-shadow .15s ease; }
  .card:hover { box-shadow: 0 3px 10px rgb(0 0 0 / .08); }
}
