:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1d2330;
  --muted: #5f6878;
  --border: #dde1e8;
  --accent: #1f6feb;
  --accent-weak: #e8f0fe;
  --good: #1a7f37;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b;
    --surface: #1b2029;
    --text: #e6e9ef;
    --muted: #9aa3b2;
    --border: #2c3340;
    --accent: #5b9dff;
    --accent-weak: #1c2b44;
    --good: #4ac26b;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

a { color: var(--accent); }

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.logo {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}
.logo span { color: var(--accent); }
.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: .9rem;
  margin-left: 14px;
}
.site-header nav a:hover { color: var(--accent); }

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

main.inner { padding-top: 24px; padding-bottom: 40px; }

h1 { font-size: 1.6rem; line-height: 1.4; margin: 0 0 8px; }
h2 { font-size: 1.2rem; margin: 36px 0 12px; padding-bottom: 6px; border-bottom: 2px solid var(--border); }
h3 { font-size: 1rem; margin: 20px 0 6px; }
.lead { color: var(--muted); margin: 0 0 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

/* ---- トップページのツール一覧 ---- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.tool-card {
  display: block;
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.tool-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-card .icon { font-size: 1.8rem; line-height: 1; }
.tool-card h2, .tool-card h3 { border: 0; margin: 10px 0 4px; padding: 0; font-size: 1.05rem; }
.tool-card p { margin: 0; color: var(--muted); font-size: .9rem; }

/* ---- フォーム ---- */
label { font-weight: 600; font-size: .92rem; }
input[type="text"], input[type="number"], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
input[type="text"], input[type="number"], select { height: 46px; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
textarea { min-height: 220px; resize: vertical; }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 160px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 9px 16px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: transparent; color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- 結果表示 ---- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.stat {
  background: var(--accent-weak);
  border-radius: 10px;
  padding: 12px 14px;
}
.stat .label { font-size: .8rem; color: var(--muted); }
.stat .value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: .85rem; font-weight: 600; margin-left: 2px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; }
tr.highlight td { background: var(--accent-weak); font-weight: 700; }

.note { font-size: .88rem; color: var(--muted); }

/* ---- 広告枠（AdSense のコードをここに貼る） ---- */
.ad-slot {
  margin: 28px 0;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-slot:empty::before {
  content: "広告";
  color: var(--muted);
  font-size: .75rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  width: 100%;
  text-align: center;
  padding: 36px 0;
}

/* ---- FAQ ---- */
details {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 10px 14px;
  margin-bottom: 8px;
}
summary { cursor: pointer; font-weight: 600; }
details p { margin: 8px 0 2px; }

.related { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; }
.related a {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  text-decoration: none;
  font-size: .9rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: .85rem;
}
.site-footer a { color: var(--muted); margin-right: 14px; }

@media (max-width: 480px) {
  h1 { font-size: 1.35rem; }
  .card { padding: 16px; }
  .site-header nav a { margin-left: 0; margin-right: 12px; }
}
