:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --text: #1d2125;
  --muted: #5b6470;
  --line: #e2e0d8;
  --accent: #0a6e55;
  --accent-text: #ffffff;
  --accent-weak: #e2f2ec;
  --warn-bg: #fff3d1;
  --warn-text: #5f4200;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131619;
    --surface: #1c2025;
    --text: #e7e9ec;
    --muted: #9ba5b0;
    --line: #2d333b;
    --accent: #5fd0ad;
    --accent-text: #08241c;
    --accent-weak: #17312a;
    --warn-bg: #3a2f10;
    --warn-text: #f2d58a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  line-height: 1.75;
  -webkit-text-size-adjust: 100%;
}

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

main a, .site-header a, .site-footer nav a { color: var(--accent); }
main a:hover { text-decoration-thickness: 2px; }

h1 { font-size: 1.6rem; line-height: 1.35; margin: 0.6rem 0 0.8rem; }
h2 { font-size: 1.2rem; line-height: 1.4; margin: 2.2rem 0 0.8rem; }
h3 { font-size: 1.05rem; margin: 0 0 0.4rem; }
.h1-sub { display: block; font-size: 1rem; font-weight: 500; color: var(--muted); margin-top: 0.2rem; }
.lead { margin: 0 0 1.2rem; }
.muted, .updated { color: var(--muted); font-size: 0.9rem; }

/* ヘッダー・フッター */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.site-header nav { display: flex; gap: 16px; font-size: 0.9rem; }
.site-footer { margin-top: 3rem; padding: 1.5rem 0 2rem; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 0.85rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 0.8rem; }

/* Yahoo!のクレジットは色・サイズの変更が禁止されているため、ブラウザ標準の表示に戻す。 */
.credit { display: inline-block; background: #ffffff; border-radius: 6px; margin: 0.4rem 0; }
.credit a { all: revert; }

/* お知らせ帯 */
.banner { margin: 12px 0; padding: 8px 12px; border-radius: 8px; font-size: 0.85rem; }
.banner-pr { background: var(--accent-weak); }
.banner-demo, .banner-warn { background: var(--warn-bg); color: var(--warn-text); font-weight: 600; }

.breadcrumb { font-size: 0.85rem; color: var(--muted); margin-top: 14px; }
.breadcrumb .sep { margin: 0 6px; }

/* ホーム */
.hero { padding: 1.2rem 0 0.2rem; }
.hero h1 { font-size: 1.9rem; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card ul { list-style: none; padding: 0; margin: 0; }
.card li { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 4px 0; font-size: 0.92rem; }
.card-price { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.card-price b { color: var(--text); font-size: 1rem; }

/* 集計値 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 0 0 1rem; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.stats dt { font-size: 0.8rem; color: var(--muted); }
.stats dd { margin: 0; font-size: 0.9rem; }
.stats b { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.best { background: var(--accent-weak); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 1rem; font-size: 0.95rem; }

/* ランキング */
.offers { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.offer { display: grid; grid-template-columns: 2rem 72px minmax(0, 1fr) auto; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.rank { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 0.9rem; background: var(--bg); color: var(--muted); }
.rank-top { background: var(--accent); color: var(--accent-text); }
.thumb img, .thumb-empty { display: block; width: 72px; height: 72px; border-radius: 8px; background: #ffffff; object-fit: contain; }
.thumb-empty { background: var(--bg); border: 1px dashed var(--line); }
.offer-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; font-weight: 600; font-size: 0.95rem; line-height: 1.5; text-decoration: none; }
.offer-title:hover { text-decoration: underline; }
.offer-meta { margin: 4px 0 0; font-size: 0.82rem; color: var(--muted); line-height: 1.5; }
.offer-unit { text-align: right; }
.unit-price { margin: 0 0 6px; white-space: nowrap; }
.unit-price .per { font-size: 0.75rem; color: var(--muted); }
.unit-price b { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.unit-price .yen { font-size: 0.85rem; margin-left: 1px; }
.more { margin: 8px 0 0; font-size: 0.92rem; }

.btn { display: inline-block; border: 1px solid var(--accent); border-radius: 999px; padding: 5px 14px; font: inherit; font-size: 0.82rem; font-weight: 600; text-decoration: none; cursor: pointer; background: var(--accent); color: var(--accent-text) !important; }
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--accent) !important; }

@media (max-width: 600px) {
  h1 { font-size: 1.35rem; }
  .hero h1 { font-size: 1.6rem; }
  .offer { grid-template-columns: 1.8rem 56px minmax(0, 1fr); gap: 10px; }
  .rank { width: 1.8rem; height: 1.8rem; font-size: 0.82rem; }
  .thumb img, .thumb-empty { width: 56px; height: 56px; }
  .offer-unit { grid-column: 2 / -1; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .unit-price { margin: 0; }
}

/* 文章 */
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin: 0.3rem 0; }
.link-list { list-style: none; padding-left: 0 !important; }

/* 単価計算機 */
.calc-row { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)) auto; gap: 8px; align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; }
.calc-row label { display: block; font-size: 0.78rem; color: var(--muted); }
.calc-row input { width: 100%; padding: 8px 10px; font: inherit; font-size: 1rem; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.calc-row input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.calc-remove { border: 0; background: transparent; color: var(--muted); font-size: 1.3rem; line-height: 1; padding: 8px; cursor: pointer; }
.calc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 0; }
.calc-result { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.calc-result li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.calc-result li.cheapest { border-color: var(--accent); background: var(--accent-weak); }
.calc-result b { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.calc-result .diff { color: var(--muted); font-size: 0.85rem; margin-left: 8px; }

@media (max-width: 600px) {
  .calc-row { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; }
  .calc-row .calc-name { grid-column: 1 / -1; }
}
