/* =========================================================
   商品カタログ 共通スタイル
   ジャンルごとの配色は下部の [data-genre="..."] で上書きします。
   ========================================================= */

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #2a2a2e;
  --muted: #77767d;
  --line: #ebe8ee;
  --accent: #555;
  --accent-ink: #ffffff;
  --accent-soft: #eee;
  --header-bg: #ffffff;
  --header-ink: #2a2a2e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 10, 30, 0.04), 0 4px 14px rgba(20, 10, 30, 0.05);
  color-scheme: light;
}

/* ---------- ジャンル別配色 ---------- */
[data-genre="oshi"] {
  --bg: #fff6fa;
  --line: #f6dbe7;
  --accent: #e0558f;
  --accent-soft: #fde4ef;
  --header-bg: linear-gradient(135deg, #ffd6e7 0%, #e7dcff 100%);
  --header-ink: #5b2a48;
  --muted: #8a7180;
}
[data-genre="gift"] {
  --bg: #faf7f1;
  --line: #ebe3d3;
  --accent: #2f6b58;
  --accent-soft: #e2eee7;
  --header-bg: linear-gradient(135deg, #f4ebdc 0%, #e6efe7 100%);
  --header-ink: #2d3d36;
  --muted: #7d776b;
}
[data-genre="kaiun"] {
  --bg: #f8f5ee;
  --line: #e7dfcb;
  --accent: #a9822c;
  --accent-soft: #f2e8cf;
  --header-bg: linear-gradient(135deg, #24224f 0%, #3c2f6b 100%);
  --header-ink: #f5e7bf;
  --muted: #7a7366;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
html.modal-open { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: 0.02em;
}
img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* ---------- ヘッダー ---------- */
.site-header {
  background: var(--header-bg);
  color: var(--header-ink);
  padding: 18px 0 14px;
}
.site-header .wrap { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.site-title { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: 0.06em; }
.site-tagline { margin: 2px 0 0; font-size: 12px; opacity: 0.8; }
.pr-label {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid currentColor;
  border-radius: 4px;
  padding: 1px 6px;
  margin-top: 4px;
  opacity: 0.85;
}

/* ---------- 検索（上部に固定） ---------- */
.search-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 10px 0 8px;
  border-bottom: 1px solid var(--line);
}
.search-form { position: relative; }
.search-input {
  width: 100%;
  height: 48px;
  border: 2px solid var(--accent);
  border-radius: 999px;
  background: var(--surface);
  padding: 0 88px 0 44px;
  font-size: 16px; /* iPhoneで自動ズームしない最小サイズ */
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.search-input:focus { box-shadow: 0 0 0 4px var(--accent-soft); }
.search-input::-webkit-search-cancel-button { display: none; }
.search-icon {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--accent); pointer-events: none;
}
.search-clear {
  position: absolute; right: 64px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: var(--line); color: var(--muted); font-size: 14px; line-height: 1; cursor: pointer;
}
.search-submit {
  position: absolute; right: 5px; top: 5px; height: 38px; padding: 0 14px;
  border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-size: 14px; font-weight: 700; cursor: pointer;
}

.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 2px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 5px 14px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }

/* ---------- ツールバー ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 0 8px; }
.result-count { font-size: 13px; color: var(--muted); }
.sort-select {
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px;
  padding: 4px 8px; font-size: 13px;
}

/* ---------- 商品カード（2列） ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }

.card {
  display: block; background: var(--surface); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); color: inherit; text-decoration: none;
  transition: transform 0.15s ease;
}
.card { cursor: pointer; }
.card:active { transform: scale(0.98); }
.card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.card-image { position: relative; aspect-ratio: 1 / 1; background: #fff; }
/* 画像は加工せず、縦横比を保ったまま全体を表示 */
.card-image img, .detail-image img { width: 100%; height: 100%; object-fit: contain; }
/* 楽天公式「画像のみ」コードの表示枠（コード自体は変更せず、枠内に収める） */
.official-code { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.official-code a { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.card-image .official-code img, .detail-image .official-code img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
/* 一覧ではタップで詳細を開く（楽天への移動は詳細画面の画像・ボタンから） */
.card .official-code { pointer-events: none; }
.badge-new {
  position: absolute; top: 8px; left: 8px; background: var(--accent); color: var(--accent-ink);
  font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; letter-spacing: 0.08em;
}
.card-info { padding: 8px 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.card-id {
  align-self: flex-start; font-size: 12px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); border-radius: 6px; padding: 0 7px; letter-spacing: 0.06em;
}
.card-variant {
  align-self: flex-start; font-size: 11px; font-weight: 700; color: var(--muted);
  border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; margin-top: 2px;
}
.badge-sets {
  position: absolute; top: 8px; right: 8px; background: var(--surface); color: var(--accent);
  border: 1px solid var(--accent); font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
}
.series-compare { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.series-title { font-size: 14px; margin: 0 0 8px; }
.series-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--bg);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer;
}
.series-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.series-label { font-size: 14px; font-weight: 700; }
.series-note { font-size: 12px; color: var(--muted); }
.series-arrow { font-size: 20px; color: var(--muted); }
.card-name {
  font-size: 13px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.more-button {
  display: block; width: 100%; margin: 20px 0 0; padding: 12px; border-radius: 999px;
  border: 1px solid var(--accent); background: transparent; color: var(--accent); font-weight: 700; cursor: pointer;
}
.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }

/* ---------- 詳細（ボトムシート） ---------- */
.detail {
  position: fixed; inset: 0; z-index: 50; background: rgba(20, 15, 25, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.detail-panel {
  position: relative; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto;
  background: var(--surface); border-radius: 20px 20px 0 0; padding: 18px 18px calc(22px + env(safe-area-inset-bottom));
  animation: up 0.2s ease-out;
}
@media (min-width: 640px) { .detail { align-items: center; } .detail-panel { border-radius: 20px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.detail-close {
  position: sticky; top: 0; float: right; z-index: 1; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: var(--bg); font-size: 18px; cursor: pointer;
}
.detail-image { aspect-ratio: 1 / 1; max-width: 360px; margin: 0 auto 12px; background: #fff; }
.detail-meta { display: flex; gap: 8px; align-items: center; }
.detail-category { font-size: 12px; color: var(--muted); }
.detail-name { font-size: 17px; line-height: 1.5; margin: 8px 0; }
.detail-desc { font-size: 14px; margin: 0 0 12px; white-space: pre-wrap; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tag { border: 0; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.buy-button {
  display: block; width: 100%; text-align: center; padding: 14px; border-radius: 999px; border: 0;
  background: #bf0000; /* 楽天レッド系 */ color: #fff; font-weight: 700; font-size: 16px; text-decoration: none; cursor: pointer;
}
.buy-button.is-disabled { background: #cfcbd3; color: #fff; cursor: not-allowed; }
.detail-note { text-align: center; font-size: 11px; color: var(--muted); margin: 8px 0 0; }

/* ---------- フッター ---------- */
.site-footer { margin-top: 40px; padding: 20px 0 32px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.site-footer p { margin: 0 0 8px; }
/* フッターのサイト情報リンク（サイトについて・お問い合わせ・プライバシーポリシー） */
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 12px; padding: 0; list-style: none; font-size: 12px; }
.footer-links a { color: var(--accent); text-decoration: none; }
.footer-links a:hover, .footer-links a:focus-visible { text-decoration: underline; }
/* サイト情報ページ（about / contact / privacy） */
.info-page { padding-top: 20px; padding-bottom: 8px; font-size: 14px; line-height: 1.8; }
.info-page .back { display: inline-block; margin-bottom: 12px; font-size: 13px; color: var(--accent); text-decoration: none; }
.info-page h2 { font-size: 18px; margin: 0 0 12px; }
.info-page h3 { font-size: 15px; margin: 24px 0 6px; padding-left: 10px; border-left: 4px solid var(--accent); }
.info-page p, .info-page ul { margin: 0 0 10px; }
.info-page ul { padding-left: 1.3em; }
.info-page .note { padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); }
.info-page .updated { margin-top: 24px; font-size: 12px; color: var(--muted); }
.info-page a { color: var(--accent); }
.info-page .contact-button { display: block; margin: 16px 0 8px; padding: 14px 16px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 700; text-align: center; text-decoration: none; }
.info-page .contact-button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.info-page .contact-sub { font-size: 13px; text-align: center; }
