/* 色はここでまとめて変えられる */
:root {
  --main: #a8470a;      /* 濃い橙: 見出し・金額 */
  --soft: #fdeedd;      /* 薄い橙: カード上部・表の見出し */
  --accent: #1f6f6a;    /* 青緑: NEW・強調 */
  --bg: #faf8f4;
  --line: #dcd8cf;
  --text: #26262b;
  --sub: #66646e;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.7;
  font-family: system-ui, "Yu Gothic UI", Meiryo, sans-serif; }
.wrap { max-width: 1000px; margin: 0 auto; padding: 12px 16px; }
h1 { font-size: 1.4rem; color: var(--main); margin: .4em 0; line-height: 1.5; }
a { color: var(--main); }
.sub { color: var(--sub); font-size: .85rem; }
td .sub { display: block; }

.filters { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: .9rem; }

/* 地域の選択 */
.areabar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .9rem; }
#openArea, .dfoot .apply { font: inherit; font-weight: 700; background: var(--main); color: #fff; border: 0; border-radius: 8px; padding: 8px 20px; cursor: pointer; }
#openArea::after { content: " ▼"; font-size: .75rem; }
#chips { display: contents; color: var(--sub); }
.chip { font: inherit; font-size: .85rem; background: var(--soft); color: var(--text); border: 1px solid var(--main); border-radius: 999px; padding: 2px 12px; cursor: pointer; }
dialog#areaDlg { width: min(900px, 96vw); height: min(640px, 92vh); padding: 0; border: 0; border-radius: 14px; color: var(--text); background: var(--bg); overflow: hidden; }
dialog#areaDlg[open] { display: flex; flex-direction: column; }
dialog#areaDlg::backdrop { background: rgba(38, 38, 43, .5); }
.dhead, .dfoot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; background: #fff; }
.dhead { border-bottom: 1px solid var(--line); }
.dfoot { border-top: 1px solid var(--line); justify-content: space-between; }
.dhead input { flex: 1; min-width: 12em; font: inherit; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; }
.area button.x, .area #clear, .area .back { font: inherit; background: none; border: 0; color: var(--main); text-decoration: underline; cursor: pointer; padding: 0; }
.area .back { display: none; margin-bottom: 8px; }
.dbody { flex: 1; min-height: 0; display: grid; grid-template-columns: 300px minmax(0, 1fr); }
.preflist, .citypane { overflow-y: auto; padding: 10px 14px; }
.preflist { border-right: 1px solid var(--line); }
.region { font-size: .8rem; font-weight: 700; color: var(--sub); margin: 12px 0 4px; }
.prefs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.pref { font: inherit; font-size: .85rem; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 5px 2px; cursor: pointer; color: var(--text); }
.pref[aria-pressed="true"] { background: var(--soft); border-color: var(--main); font-weight: 700; }
.pref:disabled { color: #b4b1aa; background: transparent; cursor: default; }
.num:not(:empty) { display: inline-block; min-width: 1.5em; margin-left: 3px; border-radius: 999px; background: var(--main); color: #fff; font-size: .72rem; font-weight: 700; }
.area input[type="checkbox"] { width: 1.15em; height: 1.15em; accent-color: var(--main); margin: 0; flex: none; }
.item, .allrow { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: .9rem; }
.item[hidden], .allrow[hidden], .panel[hidden], .hint[hidden] { display: none; }
.item:has(input:checked) { background: var(--soft); border-color: var(--main); }
.cnt { margin-left: auto; color: var(--sub); font-size: .78rem; }
.panel h3 { margin: 0 0 6px; font-size: 1rem; color: var(--main); }
.allrow { margin-bottom: 8px; font-weight: 700; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(11em, 1fr)); gap: 6px; margin-bottom: 14px; }
.item.own { grid-column: 1 / -1; font-weight: 700; }
.hint { color: var(--sub); }
@media (max-width: 700px) {
  dialog#areaDlg { width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; margin: 0; border-radius: 0; }
  .dbody { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .preflist { border-right: 0; }
  .dbody .citypane, .dbody.picked .preflist { display: none; }
  .dbody.picked .citypane { display: block; }
  .area .back { display: inline-block; }
}
select { font: inherit; padding: 4px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }

/* 一覧: 2列、狭い画面は1列 */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
@media (max-width: 700px) { .grid { grid-template-columns: minmax(0, 1fr); } }

.card { display: flex; flex-direction: column; background: #fff; color: var(--text); text-decoration: none;
  border: 1px solid var(--line); border-top: 5px solid var(--main); border-radius: 14px; overflow: hidden;
  transition: box-shadow .15s, transform .15s; }
.card[hidden] { display: none; }
.card:hover, .card:focus-visible { box-shadow: 0 8px 22px rgba(168, 71, 10, .2); transform: translateY(-2px); }
.card > span { display: block; }
.head { background: var(--soft); padding: 12px 16px; }
.flags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-weight: 700; font-size: 1.05rem; color: var(--main); margin: 8px 0; min-height: 3.4em; }
.meta { display: flex; flex-direction: column; font-size: .82rem; color: var(--sub);
  border-top: 1px solid var(--line); padding-top: 6px; }

.state, .new, .left { display: inline-block; border-radius: 999px; padding: 0 10px; font-size: .8rem; font-weight: 700; }
.state { background: var(--main); color: #fff; }
.check .state { background: #6f655c; }
.before .state { background: #52704f; }
.closed .state { background: #85838a; }
.new { background: var(--accent); color: #fff; }
.left { border: 1px solid #b3261e; color: #b3261e; background: #fff; }
.detail .new, .detail .left { margin-left: 6px; }

.card > .amount { display: flex; align-items: center; margin: 14px 16px 0; border-bottom: 2px dotted var(--line); padding-bottom: 8px; }
.amount .label { flex: none; font-size: .8rem; color: var(--sub); margin-right: 12px; }
.amount .value { flex: 1; text-align: right; font-weight: 700; color: var(--main); }
.amount .big { font-size: 1.5rem; }
.amount .long { font-size: .98rem; }
.card > .summary { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  margin: 12px 16px; font-size: .92rem; }
.card > .tags { margin-top: auto; padding: 0 16px 14px; }
.tag { display: inline-block; background: var(--soft); color: var(--text); border-radius: 6px; padding: 0 8px; margin: 0 6px 6px 0; font-size: .78rem; }
.tag::before { content: "#"; }
/* タグの色分け: 国=青、都道府県=緑、市町村=橙。件数の内訳(.key)が色の見本になる */
.lv-kuni .tag, .key.lv-kuni { background: #dbe7fb; color: #163e7a; }
.lv-ken .tag, .key.lv-ken { background: #dbeed9; color: #1f5c2a; }
.lv-shi .tag, .key.lv-shi { background: #fde0bd; color: #7a3300; }
.key { display: inline-block; border-radius: 6px; padding: 0 8px; font-weight: 700; }
.closed { opacity: .65; }

/* PR枠とページ送り */
.pr { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 200px;
  border: 1px dashed var(--sub); border-radius: 14px; color: var(--sub); font-size: .9rem; }
.pr[hidden] { display: none; }
.prmark { border: 1px solid var(--sub); border-radius: 4px; padding: 0 8px; font-weight: 700; font-size: .8rem; }
.pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; }
.pager button { font: inherit; min-width: 2.6em; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--main); cursor: pointer; }
.pager button[aria-current] { background: var(--main); border-color: var(--main); color: #fff; font-weight: 700; }
.pager button:disabled { opacity: .4; cursor: default; }

/* 詳細ページ */
.detail { max-width: 800px; }
.detail.closed { opacity: 1; }
.lead { margin-top: 0; }
.detail h2 { font-size: 1.1rem; color: var(--main); margin: 1.4em 0 .5em; }
table { width: 100%; border-collapse: collapse; background: #fff; font-size: .95rem; }
th, td { border: 1px solid var(--line); padding: 12px 14px; text-align: left; vertical-align: top; }
th { width: 10em; background: var(--soft); color: var(--main); vertical-align: middle; }
td p { margin: 0 0 6px; }
.url { font-size: .78rem; color: var(--sub); word-break: break-all; }
.official { display: inline-block; background: var(--accent); color: #fff; text-decoration: none; font-weight: 700;
  padding: 6px 18px; border-radius: 8px; }
.caution { color: #b3261e; font-size: .85rem; }
@media (max-width: 600px) {
  table, tbody, tr, th, td { display: block; width: 100%; }
  th { border-bottom: 0; padding: 6px 14px; }
  tr { margin-bottom: 8px; }
}

.warn { background: #fdf1dd; border: 1px solid #e9c58a; border-radius: 8px; padding: 8px 12px; }
footer { font-size: .85rem; color: var(--sub); }

/* トップの掲載件数 */
.totals { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 20px; background: #fff;
  border: 1px solid var(--line); border-left: 6px solid var(--accent); border-radius: 10px; padding: 10px 16px; margin: 10px 0 14px; }
.totals p { margin: 0; }
.totals strong { color: var(--main); font-size: 1.15rem; }
.totals .total strong { font-size: 1.8rem; margin: 0 2px; }
