:root{
  --bg:#f7f7f8;
  --panel:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --line:#e5e7eb;
  --shadow: 0 10px 30px rgba(0,0,0,.08);
  --radius:8px;

  /* ヘッダー背景（テーマで切替） */
  --header-bg: rgba(247,247,248,.92);

  /* UIアクセント（タブ/フィルタ/スイッチなど） */
  --accent: #111827;
  --accent-text: #ffffff;

  /* バッジ */
  --badge-bg:#fafafa;
  --badge-text:#111827;

  /* hover/罫線 */
  --line-hover:#d1d5db;
  --dot-outline: rgba(17,24,39,.12);

  /* リンク下線 */
  --link-underline: rgba(17,24,39,.2);
  --link-underline-hover: rgba(17,24,39,.6);

  /* タイル幅（数に依存して伸びないよう min/max を固定） */
  --tile-min: 170px;
  --tile-max: 220px;

  --gap: 18px;

  /* ✅ カード色（濃い） */
  --card-smbc: #37915a;   /* 濃い緑 */
  --card-jcb:  #447edf;   /* 濃い青 */
  --card-mufg: #d94040;   /* 濃い赤 */
  --card-lpplus:#ffab89;  /* 濃いオレンジ */
}

/* ✅ ダークテーマ（手動切替） */
:root[data-theme="dark"]{
  --bg:#0b1220;
  --panel:#111827;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --line:#243244;
  --shadow: 0 10px 30px rgba(0,0,0,.55);
  --header-bg: rgba(11,18,32,.90);

  /* ダーク時は“反転”で見やすく */
  --accent: #e5e7eb;
  --accent-text: #111827;

  --badge-bg:#0b1220;
  --badge-text:#e5e7eb;

  --line-hover:#334155;
  --dot-outline: rgba(255,255,255,.18);

  --link-underline: rgba(229,231,235,.25);
  --link-underline-hover: rgba(229,231,235,.55);
}

/* ✅ JSが効く前（もしくはlocalStorage未設定）でもOS設定に合わせる */
@media (prefers-color-scheme: dark){
  :root:not([data-theme]){
    --bg:#0b1220;
    --panel:#111827;
    --text:#e5e7eb;
    --muted:#9ca3af;
    --line:#243244;
    --shadow: 0 10px 30px rgba(0,0,0,.55);
    --header-bg: rgba(11,18,32,.90);

    --accent: #e5e7eb;
    --accent-text: #111827;

    --badge-bg:#0b1220;
    --badge-text:#e5e7eb;

    --line-hover:#334155;
    --dot-outline: rgba(255,255,255,.18);

    --link-underline: rgba(229,231,235,.25);
    --link-underline-hover: rgba(229,231,235,.55);
  }
}

/* ✅ hidden をCSSで確実に効かせる（初期ポップアップ対策） */
[hidden]{ display:none !important; }

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  color:var(--text);
  background:var(--bg);
}

.container{
  width:min(1200px, calc(100% - 32px));
  margin:0 auto;
}


/* ✅ テーマ切替ボタン（右上・◯/●） */
.site-header .container{ position: relative; }

.theme-btn{
  position:absolute;
  top: 10px;
  right: 0;
  width: 34px;
  height: 34px;
  border:1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:18px;
  line-height:1;
  color: var(--text);
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
}

.theme-btn::before{ content:"◯"; }
:root[data-theme="dark"] .theme-btn::before{ content:"●"; }

.theme-btn:hover{
  border-color: var(--line-hover);
}
.theme-btn:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ダーク時は ● を白で */
:root[data-theme="dark"] .theme-btn{
  color:#fff;
}
.site-header{
  /* Mobile: ヘッダーは固定しない（スクロールで流れる） */
  position:static;

  z-index:10;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--line);
  padding:14px 0 10px;
}

.title-row{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.site-title{
  margin:0;
  font-size:18px;
  letter-spacing:.02em;
  width: 100%;
}
.site-title img{
  max-width: 300px;
  width: 100%;
  text-align: center;
  display: block;
  margin: 15px auto;
}
.pr{
  margin:0;
  color:var(--muted);
  font-size:12px;
  text-align: center;
}

.controls{
  margin-top:10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}

.segmented{
  display:inline-flex;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:4px;
  gap:4px;
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
}
.seg-btn{
  border:0;
  background:transparent;
  padding:9px 12px;
  border-radius:var(--radius);
  font-size:12px;
  color:var(--muted);
  cursor:pointer;
}
.seg-btn.is-active{
  background:var(--accent);
  color:var(--accent-text);
}

.control-toggles{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.switch{
  display:inline-flex;
  align-items:center;
  gap:10px;
  user-select:none;
  cursor:pointer;
}
.switch input{ display:none; }
.switch-ui{
  width:42px;
  height:24px;
  border-radius:var(--radius);
  border:1px solid var(--line);
  background:var(--panel);
  position:relative;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.02);
}
.switch-ui::after{
  content:"";
  position:absolute;
  top:50%;
  left:3px;
  transform:translateY(-50%);
  width:18px;
  height:18px;
  border-radius:50%;
  background:var(--accent);
  transition: transform .2s ease;
}
.switch input:checked + .switch-ui::after{
  transform:translate(18px,-50%);
}
.switch-text{
  font-size:12px;
  color:var(--muted);
}

.filter-area{
  margin-top:10px;
  display:flex;
  align-items:flex-start;
  gap:10px;
  flex-wrap:wrap;
}

.search-wrap{
  display:flex;
  align-items:center;
  gap:8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  min-width: 220px;
  max-width: 220px;
  flex: 1 1 260px;
}

.search-input{
  border:0;
  outline:none;
  background:transparent;
  color: var(--text);
  caret-color: var(--text);
  font-size: 13px;
  width: 100%;
  min-width: 0;
}

/* ✅ iOS / Android：入力フォーカス時の自動ズーム防止（font-size 16px以上） */
@media (hover: none) and (pointer: coarse){
  .search-input{ font-size: 16px; }
}

.search-input::placeholder{
  color: var(--muted);
}

/* ✅ iOS Safari / Chrome の search入力に付く標準の×（クリア）を消す */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration{
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.search-clear{
  border:1px solid var(--line);
  background: var(--panel);
  width: 28px;
  height: 28px;
  border-radius: 999px;
  cursor:pointer;
  line-height: 1;
  font-size: 18px;
  color: var(--muted);
  display:flex;
  align-items:center;
  justify-content:center;
}

.search-clear:hover{
  color: var(--text);
  border-color:var(--line-hover);
}

@media (max-width: 520px){
  .search-wrap{ width:100%; flex: 1 1 100%; }
  .search-wrap{
    min-width: 100%;
    max-width: 100%;
  }
  .theme-btn{
    top: 28px;
  }
}
.filter-title{
  font-size:12px;
  color:var(--muted);
  padding-top:6px;
}

.category-filters{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.cat-btn{
  border:1px solid var(--line);
  background:var(--panel);
  padding:8px 10px;
  border-radius:var(--radius);
  font-size:12px;
  cursor:pointer;
  color:var(--text);
}
.cat-btn.is-active{
  background:var(--accent);
  color:var(--accent-text);
  border-color:var(--accent);
}
.cat-count{
  opacity:.7;
  margin-left:6px;
}

main{ padding:14px 0 34px; }

.section{
  margin: 14px 0 36px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 36px;
}
#content .section:last-child{
  border-bottom: 0;
}
.section-head{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
}
.section-title{
  margin:0;
  font-size:13px;
  color:var(--muted);
  letter-spacing:.02em;
}
.section-count{
  font-size:12px;
  color:var(--muted);
}

/* ✅ 伸びすぎ対策：auto-fill + min/max */
.tiles{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(min(var(--tile-min), 100%), var(--tile-max)));
  gap: var(--gap);
  justify-content: start;
}

/* ✅ 正方形やめて、縦を詰める（余白削減） */
.tile{
  border:1px solid var(--line);
  background:var(--panel);
  color: var(--text);
  border-radius: var(--radius);
  padding:10px;
  cursor:pointer;
  text-align:left;
  box-shadow: 0 1px 0 rgba(0,0,0,.02);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
  min-height: 84px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}
.tile:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color:var(--line-hover);
}
.tile-title{
  font-size:14px;
  font-weight:900;
  line-height:1.25;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.tile-meta{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  margin-top:8px;
}
.badge{
  font-size:12px;
  padding:5px 8px;
  border-radius:var(--radius);
  border:1px solid var(--line);
  background:var(--badge-bg);
  color:var(--badge-text);
}
.badge.ghost{
  background:transparent;
  color:var(--muted);
}

/* ✅ カード色ラベル（背景） */
.badge-rate{
  border-color: transparent;
  color: #fff;
}
.badge-rate--smbc{ background: var(--card-smbc); }
.badge-rate--jcb{ background: var(--card-jcb); }
.badge-rate--mufg{ background: var(--card-mufg); }
.badge-rate--lpplus{ background: var(--card-lpplus); }

/* ✅ 対象カードを丸で表示 */
.dots{
  display:inline-flex;
  gap:6px;
  align-items:center;
}
.dot{
  width:16px;
  height:16px;
  border-radius:999px;
  display:inline-block;
  box-shadow: 0 0 0 1px var(--dot-outline);
}
.dot--smbc{ background: var(--card-smbc); }
.dot--jcb{ background: var(--card-jcb); }
.dot--mufg{ background: var(--card-mufg); }
.dot--lpplus{ background: var(--card-lpplus); }

/* card sections */
.card-section{
  border:1px solid var(--line);
  background:var(--panel);
  border-radius: var(--radius);
  padding:12px;
  margin:14px 0 16px;
  box-shadow: 0 1px 0 rgba(0,0,0,.02);
}

/* ✅ カードから探す：カード枠の内側paddingでグリッドが細くなりすぎるのを防ぐ */
.card-section .tiles{
  margin-left: -12px;
  margin-right: -12px;
  padding-left: 12px;
  padding-right: 12px;
}

/* ✅ カード別セクションに色アクセント */
.card-section--smbc{ border-top:4px solid var(--card-smbc); }
.card-section--jcb{ border-top:4px solid var(--card-jcb); }
.card-section--mufg{ border-top:4px solid var(--card-mufg); }
.card-section--lpplus{ border-top:4px solid var(--card-lpplus); }

.card-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;

  /* ✅ レスポンシブ崩れ防止 */
  flex-wrap:wrap;
}
.card-left{
  display:flex;
  align-items:center;
  gap:10px;

  /* ✅ レスポンシブ崩れ防止 */
  flex: 1 1 auto;
  min-width: 0;
}
.card-name{
  font-weight:900;
  font-size:14px;
  line-height:1.25;
  word-break: break-word;
}
.card-sub{
  color:var(--muted);
  font-size:12px;
  margin-top:2px;
}

/* card visuals */
.card-visual{
  width:64px;
  height:40px;
  border-radius:10px;
  border:1px solid var(--line);
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
  color:white;
  font-size:10px;
  font-weight:900;
  letter-spacing:.02em;
  flex: 0 0 auto;
}
.card-visual img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.card-visual--smbc{ background: var(--card-smbc); }
.card-visual--jcb{ background: var(--card-jcb); }
.card-visual--mufg{ background: var(--card-mufg); }
.card-visual--lpplus{ background: var(--card-lpplus); }

/* footer */
.site-footer{
  padding:18px 0 26px;
  border-top:1px solid var(--line);
}
.footer-title{
  margin:0 0 10px;
  font-size:13px;
  color:var(--muted);
}
.sources{
  margin:0;
  padding-left:18px;
  color:var(--text);
}
.sources a{
  color:var(--text);
  text-decoration:none;
  border-bottom:1px solid var(--link-underline);
}
.sources a:hover{
  border-bottom-color: var(--link-underline-hover);
}
.footer-note{
  margin:10px 0 0;
  font-size:12px;
  color:var(--muted);
}

.footer-brand{
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}
.footer-brand a{
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--link-underline);
}
.footer-brand a:hover{
  border-bottom-color: var(--link-underline-hover);
}

/* modal */
.modal-backdrop{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.40);
  display:flex;

  /* ✅ 画面中央に出す */
  align-items:center;

  justify-content:center;
  padding:14px;

  z-index:1000;
}
.modal{
  width:min(720px, 100%);
  max-height:min(82vh, 760px);
  overflow:auto;
  background:var(--panel);
  border-radius: 18px;
  box-shadow: var(--shadow);
  border:1px solid rgba(255,255,255,.12);
}
.modal-header{
  position:sticky;
  top:0;
  background:var(--panel);
  border-bottom:1px solid var(--line);
  padding:14px 14px 10px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.modal-kicker{
  color:var(--muted);
  font-size:12px;
}
.modal-title{
  font-size:16px;
  font-weight:900;
  margin-top:2px;
}
.icon-button{
  border: 0;
  background:var(--panel);
  color: var(--text);
  width:34px;
  height:34px;
  border-radius: 10px;
  cursor:pointer;
  font-size:18px;
  line-height:1;
}
.modal-body{
  padding:12px 14px 16px;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.offer{
  border:1px solid var(--line);
  border-radius: 16px;
  padding:12px;
  display:flex;
  gap:12px;
  align-items:flex-start;
  background:var(--panel);
}

/* ✅ カード色をポップアップにも反映（左アクセント） */
.offer--smbc{ border-left:6px solid var(--card-smbc); }
.offer--jcb{ border-left:6px solid var(--card-jcb); }
.offer--mufg{ border-left:6px solid var(--card-mufg); }
.offer--lpplus{ border-left:6px solid var(--card-lpplus); }

.offer-main{
  flex:1;
  min-width:0;
}
.offer-title{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:8px;
  flex-wrap:wrap;
}
.offer-cardname{
  font-weight:900;
  font-size:14px;
}
.offer-rate{
  font-weight:900;
  font-size:14px;
}
.offer-row{
  margin-top:8px;
  font-size:12px;
  color:var(--muted);
  line-height:1.45;
}
.offer-row strong{
  color:var(--text);
  font-weight:900;
}
.offer-conds{
  margin:8px 0 0;
  padding-left:18px;
  color:var(--muted);
  font-size:12px;
  line-height:1.45;
}
.offer-link{
  margin-top:10px;
  display:inline-block;
  font-size:12px;
  color:var(--text);
  text-decoration:none;
  border-bottom:1px solid var(--link-underline);
}
.offer-link:hover{
  border-bottom-color: var(--link-underline-hover);
}



/* ✅ PCのみ：ヘッダーを固定（sticky） */
@media (min-width: 820px){
  .site-title img{
    max-width: 300px;
    width: 100%;
  }
}

@media (max-width: 520px){
  /* ✅ iOSの入力フォーカス時ズーム防止（16px以上） */
  .search-input{ font-size:16px; }

  /* ✅ スマホでも最低2列（tile-min/tile-maxを無視して2カラム固定） */
  .tiles{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* ついでに縮んだ時のはみ出し予防（保険） */
  .tile{ min-width: 0; }

  .site-subtitle{ width:100%; }
  .card-visual{ width:56px; height:36px; }
  .offer{ padding:10px; }
  .modal-backdrop{ padding:10px; }
}

/* 支払い方法リンク（ポップアップの店舗名横） */
.modal-title{
  display:flex;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
}
.pay-guide{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:4px 8px;
  border-radius:999px;
  background:#6b7280;
  color:#fff;
  font-size:11px;
  font-weight:700;
  text-decoration:none;
  line-height:1.1;
}
.pay-guide:hover{
  filter: brightness(0.95);
}
