:root {
  --bg: #f6f7f4; --card: #fff; --text: #1f2a1f; --muted: #5f6b5f; --line: #d9ddd4;
  --accent: #2f6b3a; --accent-text: #fff; --danger: #b3261e; --warn: #9a5b00;
  --j-yes: #c62828; --j-suspect: #ef6c00; --j-none: #6a1b9a; --j-no: #607d8b;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
main { max-width: 980px; margin: 0 auto; padding: 12px 16px 40px; }
h1 { font-size: 1.1rem; margin: 0; }
h1 small { font-weight: normal; color: var(--muted); font-size: .8rem; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.badge { display: inline-block; padding: 0 8px; border-radius: 10px; background: #e7efe4; color: var(--accent); font-size: .8rem; }
.mockbar { background: #fff4d6; border-bottom: 1px solid #ecd9a0; padding: 6px 16px; font-size: .85rem; }
.mockbar select { width: auto; max-width: 100%; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 14px; }
.narrow { max-width: 520px; margin: 24px auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--danger); font-weight: bold; }
.hint { background: #eef5ec; padding: 6px 10px; border-radius: 6px; font-size: .9rem; }
.gsi { min-height: 44px; margin: 12px 0; }

button { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text); cursor: pointer; }
button.secondary { background: var(--card); color: var(--accent); }
button.danger { background: var(--card); color: var(--danger); border-color: var(--danger); }
button.link { background: none; border: none; color: var(--accent); text-decoration: underline; padding: 4px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid #b9c0b3; border-radius: 6px; width: 100%; background: #fff; color: var(--text); }
input[type=radio], input[type=checkbox] { width: auto; }
label { display: block; margin: 8px 0; font-size: .92rem; }
label.inline { display: inline-block; margin-right: 14px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 12px 0; padding: 8px 12px 12px; }
legend { font-size: .92rem; font-weight: bold; padding: 0 4px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > label { flex: 1 1 160px; }
.row.wrap > button { margin: 8px 0; }

.tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 2px solid var(--line); }
.tabs button { background: none; color: var(--muted); border: none; border-radius: 0; padding: 8px 14px; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: bold; }

.map { height: 380px; border-radius: 10px; border: 1px solid var(--line); z-index: 0; }
.small-map { height: 260px; margin-bottom: 8px; }
.filters { display: flex; gap: 10px; align-items: flex-end; margin: 8px 0; }
.filters label { margin: 0; }
.filters select { width: auto; }

.list { display: grid; gap: 8px; }
.item { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--j-none); border-radius: 8px; padding: 10px 12px; cursor: pointer; text-align: left; color: var(--text); width: 100%; }
.item:hover { background: #fbfcfa; }
.item .t { font-weight: bold; }
.item .m { font-size: .85rem; color: var(--muted); }
.jd-yes { border-left-color: var(--j-yes); } .jd-suspect { border-left-color: var(--j-suspect); }
.jd-none { border-left-color: var(--j-none); } .jd-no { border-left-color: var(--j-no); }
.item.done { border-left-style: dashed; }
.tag { display: inline-block; font-size: .75rem; padding: 0 6px; border-radius: 8px; background: #eceee9; margin-left: 4px; font-weight: normal; }
.tag.me { background: #fde7c7; }

.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { position: relative; width: 120px; }
.thumb img { width: 120px; height: 120px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.thumb button { width: 100%; margin-top: 4px; padding: 4px; font-size: .8rem; }
.photo-full img { max-width: 100%; border-radius: 6px; margin-bottom: 8px; }

dialog { width: min(760px, 96vw); max-height: 92vh; border: none; border-radius: 12px; padding: 0; }
dialog::backdrop { background: rgba(0,0,0,.4); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: var(--card); padding: 12px 16px; border-bottom: 1px solid var(--line); z-index: 2; }
.dialog-head h2 { margin: 0; }
#detailBody { padding: 12px 16px 20px; }
dl.kv { display: grid; grid-template-columns: 8em 1fr; gap: 4px 12px; margin: 0 0 12px; }
dl.kv dt { color: var(--muted); font-size: .9rem; }
dl.kv dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.box { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 12px; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.timeline li { border-left: 3px solid var(--line); padding: 2px 0 6px 10px; }
.timeline .when { color: var(--muted); font-size: .8rem; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { border-bottom: 1px solid var(--line); padding: 6px; text-align: left; vertical-align: middle; }
td input, td select { min-width: 7em; }
#contactTable td { padding: 3px; }
#contactTable td:first-child { white-space: nowrap; font-size: .85rem; }
#contactTable input { min-width: 8em; padding: 4px 6px; font-size: .85rem; }
.tag.warn { background: #f9d4d1; color: #8c1d18; }
.tag.soon { background: #fde7c7; color: #7a4a00; }
.tag.alert-priority, .tag.alert-check { background: #b3261e; color: #fff; }
.tag.alert-front, .tag.alert-outside { background: #fde7c7; color: #7a4a00; }
.alert-list { list-style: none; padding: 0; margin: 0 0 10px; }
.alert-list li { padding: 6px 10px; border-radius: 6px; margin-bottom: 4px; font-size: .9rem; font-weight: bold; }
.alert-list .a-priority, .alert-list .a-check { background: #f9d4d1; color: #8c1d18; }
.alert-list .a-front, .alert-list .a-outside { background: #fde7c7; color: #7a4a00; }
.map-toggle { background: rgba(255,255,255,.95); padding: 4px 8px; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,.3); font-size: .8rem; }
.map-toggle label { display: flex; gap: 6px; align-items: center; margin: 0; cursor: pointer; }
.map-toggle input { width: auto; }
#zoneTable select { min-width: 12em; }
table.num th { font-size: .78rem; vertical-align: bottom; }
table.num td { text-align: right; white-space: nowrap; }
table.num td.l { text-align: left; }
table.num tr.total td { font-weight: bold; border-top: 2px solid var(--line); }
table.num td.first { color: var(--danger); font-weight: bold; text-align: center; }
.stage { background: #f3f6f1; border-radius: 8px; padding: 6px 12px; margin-bottom: 8px; font-size: .9rem; }
.stage p { margin: 4px 0; }
button.link.small { font-size: .8rem; padding: 0; }
.contact { background: #f3f6f1; border-radius: 8px; padding: 8px 12px; font-size: .9rem; margin-top: 8px; }
.contact p { margin: 2px 0; }
#permTable td:not(:first-child), #permTable th:not(:first-child) { text-align: center; width: 8em; }
#permTable input[type=checkbox] { min-width: 0; width: 22px; height: 22px; }
#permTable .desc { display: block; font-size: .78rem; color: var(--muted); }
#permTable tr.off td:first-child { color: var(--muted); }

/* 地図の印：淡色地図の上で目立つよう、白い縁取りと影を付ける */
.mk-pin { background: none; border: none; }
.mk-pin svg { display: block; filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); }
.mk-area { background: none; border: none; }
.mk-area span { position: relative; display: block; width: 30px; height: 30px; border-radius: 50%; border: 4px solid; background: rgba(255,255,255,.85); box-shadow: 0 0 0 2px #fff, 0 2px 4px rgba(0,0,0,.45); box-sizing: border-box; }
.mk-area span::after { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: currentColor; opacity: .55; }
.map-legend { background: rgba(255,255,255,.95); padding: 6px 10px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.3); font-size: .78rem; line-height: 1.7; }
.map-legend div { display: flex; align-items: center; gap: 6px; }
.map-legend i { display: inline-block; flex: none; }
.lg-pin { width: 12px; height: 12px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.lg-area { width: 13px; height: 13px; border-radius: 50%; border: 3px solid var(--c); background: #fff; box-sizing: border-box; }

/* 投稿フォーム：タップで選ぶ部品 */
.q { border-top: 1px solid var(--line); padding: 14px 0 6px; }
.q h3 { font-size: 1rem; margin: 0 0 10px; }
.q h3 small { display: block; font-weight: normal; color: var(--muted); font-size: .8rem; }
.req { display: inline-block; font-size: .7rem; font-weight: bold; color: #fff; background: var(--danger); border-radius: 4px; padding: 0 5px; vertical-align: middle; }
.sub { margin: 12px 0 6px; font-size: .9rem; font-weight: bold; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; margin: 0; }
.chip input, .kind-card input, .file-btn input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span { display: inline-flex; align-items: center; min-height: 42px; padding: 6px 14px; border: 1px solid #b9c0b3; border-radius: 21px; background: #fff; cursor: pointer; user-select: none; }
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip input[type=checkbox]:checked + span::before { content: '✓ '; white-space: pre; }
.chip input:focus-visible + span, .kind-card:focus-within { outline: 3px solid #9cc59f; outline-offset: 2px; }
.kind-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.kind-card { position: relative; margin: 0; border: 2px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; overflow: hidden; display: flex; flex-direction: column; }
.kind-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #eee; }
.kind-card .noimg { aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; background: #f0f2ed; color: var(--muted); font-size: .8rem; padding: 8px; text-align: center; }
.kind-card .body { padding: 6px 8px 8px; }
.kind-card strong { display: block; }
.kind-card .desc { display: block; font-size: .78rem; color: var(--muted); line-height: 1.4; }
.kind-card .zoom { font-size: .78rem; }
.kind-card .mark { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.9); border: 2px solid #b9c0b3; display: flex; align-items: center; justify-content: center; font-weight: bold; color: transparent; }
.kind-card:has(input:checked) { border-color: var(--accent); background: #eef5ec; }
.kind-card:has(input:checked) .mark { background: var(--accent); border-color: var(--accent); color: #fff; }
.credit { font-size: .75rem; color: var(--muted); margin: 6px 0 0; }
button.wide, .file-btn { display: block; width: 100%; padding: 12px; font-size: 1rem; margin: 8px 0; text-align: center; }
.file-btn { position: relative; border: 1px dashed var(--accent); border-radius: 8px; color: var(--accent); background: #fff; cursor: pointer; }
.photo-guide { display: flex; gap: 12px; align-items: flex-start; font-size: .9rem; }
.photo-guide img { width: 90px; height: 120px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.photo-guide p { margin: 0 0 4px; }
.photo-guide ol { margin: 0 0 6px; padding-left: 1.3em; }
details.more { margin-top: 12px; }
details.more summary { cursor: pointer; color: var(--accent); }
#speciesOther, #foundDate { margin-top: 8px; max-width: 280px; }
label.check { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; }
label.check input { margin-top: 5px; }
.chips.scale { gap: 6px; }
.chips.scale span { min-width: 38px; padding: 6px 9px; justify-content: center; }
.scale-desc { font-size: .8rem; color: var(--muted); margin: 4px 0 0; min-height: 1.3em; }
.vitality { margin: 10px 0 0; font-size: .9rem; }
.vitality strong { padding: 1px 8px; border-radius: 10px; background: #eceee9; }
.vitality .v-good { background: #e3f1e0; } .vitality .v-caution { background: #fff1d6; }
.vitality .v-serious { background: #fde0cc; } .vitality .v-bad { background: #f9d4d1; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #263326; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 1000; max-width: 90vw; }
.toast.err { background: var(--danger); }
.foot { text-align: center; padding: 12px; }
@media (max-width: 560px) {
  .map { height: 300px; }
  dl.kv { grid-template-columns: 6.5em 1fr; }
}
