:root {
  --bg: #fbf7f0; --card: #fff; --text: #2f2a24; --muted: #756b5f;
  --accent: #1f7a6e; --accent-weak: #e4f3ef; --on-accent: #fff;
  --cta: #b9561f; --cta-weak: #fdf0e6; --on-cta: #fff;
  --border: #eee4d6; --bar2: #d8cbb8; --warn: #b54708;
  --shadow: 0 2px 12px rgba(80, 60, 30, .07);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1916; --card: #25221e; --text: #f2ede5; --muted: #b5ab9d;
    --accent: #5ec4b6; --accent-weak: #1d3531; --on-accent: #10201d;
    --cta: #f08a50; --cta-weak: #33261c; --on-cta: #1b1916;
    --border: #39332c; --bar2: #6d6357; --warn: #f79009;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.85;
  font-family: "Zen Maru Gothic", -apple-system, BlinkMacSystemFont, "Hiragino Maru Gothic ProN", "Hiragino Sans", sans-serif; }
a { color: var(--accent); }

/* サイト上部 */
.topbar, nav.tabs, header.hero, main, footer { max-width: 760px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.topbar { padding-top: 16px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none; }
.brand .logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-weak); font-size: 1.1rem; }
nav.tabs { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; }
nav.tabs a { flex: none; padding: 6px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--border);
  color: var(--muted); text-decoration: none; font-size: .88rem; font-weight: 500; }
nav.tabs a:hover { color: var(--accent); border-color: var(--accent); }
nav.tabs a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

header.hero { display: flex; align-items: center; gap: 16px; padding-top: 24px; }
header.hero .icon { flex: none; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px;
  background: var(--accent-weak); font-size: 2rem; }
h1 { font-size: 1.5rem; line-height: 1.4; margin: 0 0 4px; }
.lead { color: var(--muted); margin: 0; font-size: .95rem; }

/* カード・入力 */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 22px; padding: 22px; margin-top: 22px; box-shadow: var(--shadow); }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
label { display: block; font-size: .88rem; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
input, select { width: 100%; padding: 12px 14px; font: inherit; font-size: 1.05rem; border: 2px solid var(--border); border-radius: 14px;
  background: var(--bg); color: var(--text); }
input:focus, select:focus { outline: none; border-color: var(--accent); }
.note { font-size: .88rem; color: var(--muted); margin: 12px 0 0; }
.note.warn { color: var(--warn); font-weight: 700; }

/* 結果 */
.result { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.stat { flex: 1 1 160px; background: var(--accent-weak); border-radius: 16px; padding: 12px 16px; }
.stat .k { font-size: .82rem; color: var(--muted); }
.stat .v { font-size: 1.3rem; font-weight: 700; }
.stat.main { flex-basis: 100%; background: var(--accent); color: var(--on-accent); padding: 16px 20px; }
.stat.main .k { color: inherit; opacity: .85; font-size: .9rem; }
.stat.main .v { font-size: 2rem; }

/* グラフ・表 */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 180px; margin-top: 24px; }
.chart .col { flex: 1; display: flex; flex-direction: column-reverse; min-width: 0; height: 100%; }
.chart .col > div:last-child { border-radius: 5px 5px 0 0; }
.chart .p { background: var(--bar2); }
.chart .g { background: var(--accent); }
.legend { font-size: .82rem; color: var(--muted); margin-top: 8px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 4px 0 12px; vertical-align: middle; }
.legend .lp::before { background: var(--bar2); }
.legend .lg::before { background: var(--accent); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; margin-top: 16px; }
th, td { padding: 7px 10px; text-align: right; }
th { color: var(--muted); font-weight: 500; border-bottom: 2px solid var(--border); }
tbody tr:nth-child(even) { background: var(--bg); }
th:first-child, td:first-child { text-align: left; }
.table-wrap { max-height: 320px; overflow: auto; margin-top: 8px; border-radius: 12px; }

/* 広告: AdSense 審査通過後に display を block に戻す */
.ad { display: none; margin-top: 24px; min-height: 100px; }

/* アフィリエイト */
.aff { background: var(--cta-weak); border-color: transparent; }
.aff strong { font-size: 1.05rem; }
.aff p { margin: 6px 0 0; font-size: .92rem; }
.aff a { display: block; padding: 14px; margin-top: 14px; border-radius: 999px; background: var(--cta); color: var(--on-cta);
  text-decoration: none; font-weight: 700; text-align: center; }
.aff a:hover { filter: brightness(1.08); }
.pr { font-size: .72rem; color: var(--muted); margin: 0 0 4px; }

/* 記事 */
h2 { font-size: 1.2rem; margin-top: 44px; display: flex; align-items: center; gap: 10px; }
h2::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px var(--accent-weak); }
article p { margin: 10px 0; }

/* ツール一覧 */
.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 12px; }
.tools a { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--border); border-radius: 18px;
  background: var(--card); color: var(--text); text-decoration: none; box-shadow: var(--shadow); transition: transform .15s; }
.tools a:hover { transform: translateY(-2px); border-color: var(--accent); }
.tools .ti { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--accent-weak); font-size: 1.4rem; }
.tools strong { display: block; font-size: .95rem; }
.tools small { color: var(--muted); font-size: .8rem; }

footer { margin-top: 48px; padding-top: 24px; padding-bottom: 40px; font-size: .85rem; color: var(--muted); text-align: center; border-top: 1px solid var(--border); }
footer a { color: var(--muted); }
footer p { margin: 4px 0; }
.card > h2:first-child { margin-top: 0; }
