/* ─── FONTS ─── */
@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Syne:wght@400;700;800&family=Noto+Sans+JP:wght@400;500;700&display=swap');

/* ─── VARIABLES ─── */
:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface2: #f9f8f5;
  --border: #e2e0d8;
  --text: #1a1916;
  --text-muted: #7a7870;
  --accent: #1b6ef3;
  --accent-light: #e8f0fe;
  --green: #0d7c3e;
  --green-light: #e6f4ec;
  --red: #c0392b;
  --red-light: #fde8e8;
  --orange: #c45800;
  --orange-light: #fff0e6;
  --mono: 'DM Mono', monospace;
  --display: 'Syne', sans-serif;
  --body: 'Noto Sans JP', sans-serif;
  --radius: 12px;
}

/* ─── RESET ─── */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── HEADER ─── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-family: var(--display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -.5px;
  color: var(--text);
  text-decoration: none;
}
.logo span { color: var(--accent); }

/* ─── NAV ─── */
nav { display: flex; gap: 28px; }
nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: color .15s;
  white-space: nowrap;
}
nav a:hover, nav a.active { color: var(--accent); }

/* ─── HAMBURGER BUTTON ─── */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: background .15s;
  flex-shrink: 0;
}
.nav-toggle:hover { background: var(--surface2); }
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s, opacity .25s;
  transform-origin: center;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ─── MOBILE NAV DRAWER ─── */
@media (max-width: 660px) {
  .nav-toggle { display: flex; }
  header nav {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
    z-index: 99;
  }
  header nav.open { display: flex; }
  header nav a {
    padding: 12px 24px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
  }
  header nav a:last-child { border-bottom: none; }
}

/* ─── SUB NAVIGATION ─── */
.subnav {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.subnav-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 8px 8px 8px 0;
  margin-right: 4px;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}
.subnav a {
  display: inline-block;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 4px;
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.subnav a:hover { color: var(--accent); background: var(--accent-light); }
.subnav a.active {
  color: var(--accent);
  font-weight: 700;
  background: var(--accent-light);
}
@media (max-width: 660px) {
  .subnav-label { display: none; }
  .subnav-inner { padding: 0 12px; gap: 2px; }
  .subnav a { padding: 8px 10px; font-size: 12px; }
}

/* ─── SEARCH BOX ─── */
.search-box {
  display: flex;
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  transition: border-color .15s;
}
.search-box:focus-within { border-color: var(--accent); }
.search-box input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--body);
  font-size: 15px;
  padding: 13px 0;
  background: transparent;
  color: var(--text);
}
.search-box input::placeholder { color: var(--text-muted); }
.search-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0 28px;
  font-family: var(--body);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.search-btn:hover { background: #1558cc; }
.search-btn:disabled { background: var(--text-muted); cursor: not-allowed; }
.search-icon {
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: var(--text-muted);
}

/* ─── MAIN CONTAINER ─── */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  width: 100%;
}

/* ─── TAB BUTTONS ─── */
.tab-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-family: var(--body);
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: all .15s;
}
.tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.tab-btn:hover:not(.active) {
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── RANK DOTS ─── */
.rank-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--mono);
}
.rank-1 { background: var(--green-light); color: var(--green); }
.rank-2 { background: var(--accent-light); color: var(--accent); }
.rank-3 { background: #fff3cd; color: #856404; }
.rank-n { background: #f5f5f5; color: var(--text-muted); }

/* ─── CAMPAIGN TAG ─── */
.campaign-tag,
.campaign-tag--empty,
.cp-empty {
  width: 32px;
  flex-shrink: 0;
}
.campaign-tag,
.cp-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--red-light);
  color: var(--red);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 0;
  border-radius: 4px;
  width: 32px;
}

/* ─── PROVIDER ─── */
.provider-name {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}
.provider-link {
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
}
.provider-link:hover { text-decoration: underline; color: var(--accent); }

/* ─── PRICE AMOUNT ─── */
.price-amount {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-align: right;
  white-space: nowrap;
}
.price-amount.cheapest, .price-amount.best, .price-best {
  font-size: 16px;
  font-weight: 700;
  color: var(--green);
}
.price-amount.campaign, .price-amount.cp-price, .price-campaign {
  font-size: 15px;
  font-weight: 600;
  color: var(--red);
}
.price-amount.priciest { color: var(--text-muted); }

/* ─── PRICE ROW ─── */
.price-row {
  display: grid;
  grid-template-columns: auto 1fr auto 32px;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  border-bottom: 1px solid #f0efe9;
  transition: background .1s;
}
.price-row:last-child { border-bottom: none; }
.price-row:hover { background: var(--surface2); }
.price-row.hidden { display: none; }
.price-list { padding: 8px 0; }

/* ─── LOADING / SPINNER ─── */
.loading {
  text-align: center;
  padding: 80px 0;
  color: var(--text-muted);
  font-size: 15px;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── EMPTY STATE ─── */
.empty {
  text-align: center;
  padding: 80px 0;
  color: var(--text-muted);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; }

/* ─── FILTER GROUP ─── */
.filter-group { display: flex; gap: 8px; align-items: center; }
.filter-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ─── SECTION TITLE ─── */
.section-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
}

/* ─── DATA DATE ─── */
/* ヘッダー直下に常駐表示。データ取得日・為替レート・キャンペーン注意の3項を1行で并べる */
.data-date {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  min-height: 32px;
}
.data-date-inner {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--mono);
  max-width: 1200px;
  margin: 0 auto;
  padding: 6px 24px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.data-date-inner span {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 5px;
  white-space: nowrap;
}

/* ─── FOOTER ─── */
.site-footer {
  margin-top: auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.footer-affiliate {
  background: var(--accent-light);
  border-bottom: 1px solid #c8d9fb;
  padding: 10px 24px;
}
.footer-affiliate-inner {
  max-width: 1200px;
  margin: 0 auto;
  font-size: 11px;
  color: #2a4e9a;
  line-height: 1.7;
}
.footer-affiliate-inner a {
  color: var(--accent);
  text-decoration: underline;
}

.footer-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 24px 28px;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 32px;
}

.footer-brand .footer-logo {
  font-family: var(--display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -.5px;
  color: var(--text);
  text-decoration: none;
}
.footer-brand .footer-logo span { color: var(--accent); }
.footer-brand p {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.8;
}

.footer-col h4 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.footer-col ul li a {
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  transition: color .15s;
}
.footer-col ul li a:hover { color: var(--accent); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 14px 24px;
}
.footer-bottom-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.footer-copy {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
}
.footer-legal {
  display: flex;
  gap: 20px;
}
.footer-legal a {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color .15s;
}
.footer-legal a:hover { color: var(--accent); }

@media (max-width: 768px) {
  .footer-main {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
  .footer-brand {
    grid-column: 1 / -1;
  }
}
@media (max-width: 480px) {
  .footer-main {
    grid-template-columns: 1fr;
  }
  .footer-bottom-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ─── HERO (カテゴリTOPおよびサブページ共通) ─── */
.hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 28px 24px 24px;
  text-align: center;
}
.hero-inner {
  max-width: 720px;
  margin: 0 auto;
}
.hero-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.hero-title {
  font-family: var(--display);
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 800;
  letter-spacing: -.5px;
  margin-bottom: 6px;
  line-height: 1.2;
}
.hero-title span { color: var(--accent); }
.hero-sub,
.hero-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 560px;
  margin: 0 auto;
}
.hero-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
  margin-top: 8px;
}
.hero-breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.hero-breadcrumb a { color: var(--accent); text-decoration: none; }
.hero-breadcrumb a:hover { text-decoration: underline; }

/* ─── CONTROLS BAR (フィルター・ソートUI共通) ─── */
.controls-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 56px;
  z-index: 90;
  box-shadow: 0 1px 6px rgba(0,0,0,.04);
}
.controls-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.controls-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.controls-divider { width: 1px; height: 22px; background: var(--border); flex-shrink: 0; }
.controls-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: .05em;
  white-space: nowrap;
}
.controls-spacer { flex: 1; min-width: 8px; }

.check-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  padding: 5px 10px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  transition: all .15s;
  white-space: nowrap;
  user-select: none;
}
.check-label input { display: none; }
.check-label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}

.sort-select {
  font-size: 12px;
  font-family: var(--body);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  background: var(--surface);
  cursor: pointer;
  outline: none;
  transition: border-color .15s;
}
.sort-select:focus { border-color: var(--accent); }

/* ─── RESULTS BAR ─── */
.results-bar {
  max-width: 1200px;
  margin: 20px auto 14px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.result-count-label { font-size: 13px; color: var(--text-muted); }
#resultCount { font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--accent); }
.affiliate-note {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 8px;
}

/* ─── CATEGORY GRID / CARD (各カテゴリTOPページ共通) ─── */
.category-grid {
  max-width: 1200px;
  margin: 32px auto 64px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow .2s, transform .2s;
}
.category-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,.08);
  transform: translateY(-2px);
}
.category-card-icon { font-size: 32px; }
.category-card-name {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
}
.category-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.category-card-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  margin-top: auto;
}

@media (max-width: 820px) {
  .controls-inner { padding: 8px 16px; }
  .results-bar { padding: 0 16px; }
  .affiliate-note { display: none; }
  .category-grid { padding: 0 16px; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .category-grid { grid-template-columns: 1fr; }
}
