:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1d2321;
  --muted: #5d6764;
  --line: #e4e1da;
  --brand: #0f5f5c;
  --brand-soft: #e3efed;
  --cheap: #1f7a5a;
  --cheap-soft: #e2f1ea;
  --middle: #8a8f8d;
  --middle-soft: #eeeeec;
  --expensive: #b5532a;
  --expensive-soft: #f8e7de;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121615;
    --surface: #1a1f1e;
    --text: #e6eae8;
    --muted: #9aa4a1;
    --line: #2c3432;
    --brand: #5fb8b2;
    --brand-soft: #1d3332;
    --cheap: #5cc49a;
    --cheap-soft: #193128;
    --middle: #9aa09e;
    --middle-soft: #262b2a;
    --expensive: #e58a62;
    --expensive-soft: #3a241b;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  font-feature-settings: "palt";
}
a { color: var(--brand); text-underline-offset: 3px; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; letter-spacing: .02em; }
.brand-sub { display: block; font-size: 10px; font-weight: 500; color: var(--muted); letter-spacing: 0; line-height: 1.2; }
.nav { display: flex; gap: 16px; font-size: 14px; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--brand); font-weight: 600; }

.hero { padding: 28px 0 8px; }
.eyebrow { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
h1 { font-size: 26px; line-height: 1.4; margin: 0 0 12px; letter-spacing: .01em; word-break: auto-phrase; text-wrap: balance; }
.section-title, h3, .lead { word-break: auto-phrase; }
.lead { font-size: 16px; margin: 0 0 12px; }
.section-title { font-size: 19px; margin: 32px 0 10px; }
h3 { font-size: 16px; margin: 0 0 6px; }
.note { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.num { font-variant-numeric: tabular-nums; }

.verdict { display: inline-block; font-weight: 600; font-size: 14px; padding: 4px 12px; border-radius: 999px; margin: 4px 0 8px; }
.verdict-cheap { background: var(--cheap-soft); color: var(--cheap); }
.verdict-middle { background: var(--middle-soft); color: var(--muted); }
.verdict-expensive { background: var(--expensive-soft); color: var(--expensive); }
.caution { font-size: 14px; background: var(--expensive-soft); border-radius: var(--radius); padding: 8px 12px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.pair { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 16px; }
.pair h2 { font-size: 15px; margin: 0 0 6px; }
.card-cheap { border-top: 3px solid var(--cheap); }
.card-expensive { border-top: 3px solid var(--expensive); }
.mini-rank { margin: 0; padding: 0; list-style: none; counter-reset: r; }
.mini-rank li { display: flex; gap: 10px; padding: 2px 0; counter-increment: r; }
.mini-rank li::before { content: counter(r); color: var(--muted); font-weight: 700; width: 1em; }
.mini-rank li .num { margin-left: auto; }

.rank-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.rank-row { border-bottom: 1px solid var(--line); }
.rank-link {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  grid-template-areas: "no name per" "no bar bar" "no sub sub";
  column-gap: 10px;
  row-gap: 2px;
  padding: 10px 2px;
  color: var(--text);
  text-decoration: none;
}
.rank-link:hover { background: var(--brand-soft); }
.rank-no { grid-area: no; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank-name { grid-area: name; font-weight: 600; }
.rank-per { grid-area: per; font-weight: 700; font-variant-numeric: tabular-nums; }
.rank-per small { font-weight: 400; font-size: 12px; margin-left: 2px; }
.bar { grid-area: bar; height: 6px; background: var(--middle-soft); border-radius: 3px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 3px; background: var(--middle); }
.bar-fill.cheap { background: var(--cheap); }
.bar-fill.expensive { background: var(--expensive); }
.rank-sub { grid-area: sub; font-size: 12px; color: var(--muted); }
.badge-low { font-size: 11px; font-weight: 500; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 6px; vertical-align: 1px; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; }
.stat-value small { font-size: 13px; font-weight: 400; margin-left: 2px; }
.stat-sub { font-size: 11px; color: var(--muted); }

.persona { display: grid; gap: 10px; }
.persona p { margin: 0; font-size: 15px; }

table { border-collapse: collapse; width: 100%; font-size: 14px; }
.kv th, .kv td, .list th, .list td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
.kv th { color: var(--muted); font-weight: 500; width: 46%; }
.list th { color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; }
.list td.num { text-align: right; white-space: nowrap; }
.list td:last-child { white-space: nowrap; }
.list .sub { display: block; font-size: 11px; color: var(--muted); }
.table-scroll { overflow-x: auto; }

.crumbs { font-size: 13px; color: var(--muted); padding-top: 14px; }
.pager { display: flex; flex-direction: column; gap: 6px; margin: 32px 0 8px; font-size: 14px; }

.explain ul, .prose ul { padding-left: 1.2em; }
.explain li, .prose li { margin-bottom: 6px; }
.prose h2 { font-size: 19px; margin: 28px 0 8px; }
.formula { background: var(--brand-soft); border-radius: var(--radius); padding: 10px 12px; font-weight: 600; }

.h-sub { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }

.story { margin: 16px 0 12px; }
.story-title { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.story-flow { display: flex; flex-direction: column; align-items: stretch; }
.story-box { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px; background: var(--bg); }
.story-icon { font-size: 20px; line-height: 1; }
.story-k { font-size: 14px; color: var(--muted); }
.story-v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.story-arrow { text-align: center; color: var(--muted); font-size: 14px; line-height: 1.4; }
.story-result { grid-template-columns: 1fr auto; background: var(--brand-soft); }
.story-result .story-k { color: var(--text); font-weight: 600; }
.story-result .story-v { color: var(--brand); font-size: 26px; }

.rule { display: grid; gap: 6px; margin: 4px 0 18px; }
.rule-row { margin: 0; font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.rule-tag { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.rule-tag.cheap { background: var(--cheap-soft); color: var(--cheap); }
.rule-tag.expensive { background: var(--expensive-soft); color: var(--expensive); }

.meter { margin: 8px 0 4px; }
.meter-pins { position: relative; height: 30px; }
.meter-pin { position: absolute; bottom: 2px; transform: translateX(-50%); font-size: 12px; color: var(--muted); white-space: nowrap; }
.meter-pin.at-left { transform: translateX(-12px); }
.meter-pin.at-right { transform: translateX(calc(-100% + 12px)); }
.meter-pin.is-strong { bottom: 8px; font-size: 13px; font-weight: 700; color: var(--surface); background: var(--text); padding: 1px 8px; border-radius: 4px; }
.meter-track {
  position: relative; height: 14px; border-radius: 7px;
  background: linear-gradient(to right, var(--cheap-soft) 0 var(--b1), var(--middle-soft) var(--b1) var(--b2), var(--expensive-soft) var(--b2) 100%);
  border: 1px solid var(--line);
}
.meter-dot { position: absolute; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--muted); opacity: .7; }
.meter-median { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 2px dashed var(--muted); }
/* 動かせるつまみに見えないよう、地図のピンのような目印にする */
.meter-mark { position: absolute; top: -9px; bottom: -3px; width: 3px; margin-left: -1.5px; background: var(--text); border-radius: 2px; }
.meter-mark::before { content: ""; position: absolute; top: -1px; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--text); border-bottom: 0; }
.meter-ticks { position: relative; height: 18px; font-size: 10px; color: var(--muted); }
.meter-ticks span { white-space: nowrap; position: absolute; transform: translateX(-50%); top: 2px; }
.meter-ticks span:first-child { transform: none; }
.meter-ticks span:last-child { transform: translateX(-100%); }
.meter-legend { display: flex; justify-content: space-between; font-size: 12px; margin-top: 2px; }

.answer { border-radius: var(--radius); padding: 12px 14px; margin: 12px 0 14px; }
.answer-cheap { background: var(--cheap-soft); }
.answer-middle { background: var(--middle-soft); }
.answer-expensive { background: var(--expensive-soft); }
.answer-main { margin: 0; font-size: 20px; font-weight: 700; }
.answer-cheap .answer-main { color: var(--cheap); }
.answer-expensive .answer-main { color: var(--expensive); }
.answer-sub { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.answer-plain { margin: 2px 0 0; font-size: 14px; }
.stat-text { font-size: 16px; }
.per-scale { display: flex; justify-content: space-between; gap: 8px; margin: 10px 0 0; font-size: 12px; }
.cheap-txt { color: var(--cheap); }
.expensive-txt { color: var(--expensive); }

.satei-form { display: grid; gap: 14px; margin-top: 8px; }
.field { display: grid; gap: 4px; }
.field-label { font-size: 14px; font-weight: 600; }
.field-help { font-size: 12px; color: var(--muted); }
.field-unit { display: flex; align-items: center; gap: 8px; }
.satei-form select, .satei-form input {
  font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); width: 100%;
}
.field-unit input { max-width: 160px; }
.btn {
  display: inline-block; text-align: center; font: inherit; font-weight: 700; font-size: 16px; padding: 12px 20px;
  border: 0; border-radius: 999px; background: var(--brand); color: var(--surface); text-decoration: none; cursor: pointer;
}
.form-error { margin: 0; color: var(--expensive); font-size: 14px; }
.satei-result { margin-top: 20px; }
.result-card { text-align: center; }
.result-cond { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.result-label { margin: 0; font-size: 14px; }
.result-main { margin: 0; font-size: 34px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; line-height: 1.3; }
.result-range { display: flex; justify-content: center; align-items: flex-end; gap: 10px; margin: 8px 0; }
.result-range span { display: flex; flex-direction: column; }
.result-range small { font-size: 11px; color: var(--muted); }
.result-range b { font-size: 18px; font-variant-numeric: tabular-nums; }
.result-dash { color: var(--muted); }
.result-basis { margin: 8px 0 0; font-size: 12px; color: var(--muted); text-align: left; }
.ad { position: relative; margin: 14px 0; }
.ad-label { position: absolute; top: 8px; right: 10px; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; }
.ad-title { font-weight: 700; margin: 0 0 4px; }
.satei-result .answer-main { font-size: 17px; }
.owner-cta { display: block; margin: 8px 0 4px; text-decoration: none; color: var(--text); border-left: 4px solid var(--brand); }
.owner-cta-k { display: block; font-size: 12px; color: var(--muted); }
.owner-cta-v { display: block; font-weight: 700; color: var(--brand); }
.owner-link { display: inline-block; margin-top: 8px; font-weight: 600; }

.district-links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; border-top: 1px solid var(--line); }
.district-links li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 15px; }
.district-links small { font-size: 11px; color: var(--muted); margin-left: 4px; }
@media (min-width: 640px) { .district-links { grid-template-columns: 1fr 1fr; column-gap: 24px; } }

.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 20px 0 32px; font-size: 12px; color: var(--muted); }
.site-footer p { margin: 0 0 8px; }

@media (min-width: 640px) {
  h1 { font-size: 30px; }
  .pair { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .persona { grid-template-columns: repeat(3, 1fr); }
}
