:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --text: #1c2321;
  --muted: #5b6663;
  --accent: #1a7a4a;
  --accent-soft: #e3f2ea;
  --warn: #9a6700;
  --warn-soft: #fff3d6;
  --closed: #8a4b4b;
  --border: #dde2dd;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141816;
    --surface: #1e2422;
    --text: #e8ece9;
    --muted: #9aa5a0;
    --accent: #4cc38a;
    --accent-soft: #1d3328;
    --warn: #e3b341;
    --warn-soft: #3a2f14;
    --closed: #d99;
    --border: #303834;
    --shadow: 0 1px 3px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.site-header { padding: 16px 16px 8px; max-width: 720px; margin: 0 auto; }
.site-header h1 { margin: 0; font-size: 1.35rem; }
.tagline { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }

.controls { max-width: 720px; margin: 0 auto; padding: 8px 16px; display: flex; flex-direction: column; gap: 8px; }
.controls-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.controls input[type="search"] {
  flex: 1; min-width: 160px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 1rem;
}
.controls select {
  padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: .95rem; max-width: 46%;
}
.btn {
  padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: .95rem; cursor: pointer;
}
.btn:active { transform: scale(.98); }
.toggle {
  display: inline-flex; align-items: center; gap: 6px; font-size: .95rem;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; user-select: none;
}
.toggle input { accent-color: var(--accent); width: 18px; height: 18px; }

.tabs { display: flex; max-width: 720px; margin: 4px auto 0; padding: 0 16px; gap: 6px; }
.tab {
  flex: 1; padding: 10px; font-size: 1rem; cursor: pointer;
  border: 1px solid var(--border); border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--bg); color: var(--muted);
}
.tab.active { background: var(--surface); color: var(--text); font-weight: 600; }

main { max-width: 720px; margin: 0 auto; padding: 0 16px 24px; min-height: 72vh; }
.result-count { color: var(--muted); font-size: .85rem; margin: 10px 2px; }

.cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.card summary {
  padding: 12px 14px; cursor: pointer; list-style: none; position: relative;
}
.card summary::-webkit-details-marker { display: none; }
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card h2 { margin: 0; font-size: 1.02rem; }
.dist { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.badge {
  font-size: .78rem; padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
}
.badge.type { background: transparent; border: 1px solid var(--border); color: var(--muted); font-weight: 400; }
.badge.unknown { background: var(--warn-soft); color: var(--warn); }
.badge.closed { background: transparent; border: 1px solid var(--border); color: var(--closed); font-weight: 400; }
.card-addr { color: var(--muted); font-size: .88rem; margin-top: 4px; }

.card-body { padding: 0 14px 14px; border-top: 1px dashed var(--border); font-size: .92rem; }
.card-body dl { margin: 10px 0; }
.card-body dt { font-weight: 600; margin-top: 8px; }
.card-body dd { margin: 1px 0 0; color: var(--muted); }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.card-actions a {
  text-decoration: none; padding: 9px 14px; border-radius: var(--radius);
  font-size: .92rem; border: 1px solid var(--border); color: var(--text); background: var(--surface);
}
.card-actions a.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.meta-line { color: var(--muted); font-size: .78rem; margin-top: 10px; }

.custom-time { display: inline-flex; align-items: center; gap: 4px; }
.custom-time[hidden] { display: none; }
.custom-time select { max-width: none; }

.unknown-section {
  margin-top: 18px; border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 0 12px 12px; background: transparent;
}
.unknown-section summary {
  cursor: pointer; padding: 12px 2px; color: var(--warn); font-weight: 600; font-size: .92rem;
}
.unknown-note { color: var(--muted); font-size: .85rem; margin: 0 0 10px; }
.unknown-section .card { opacity: .88; }

#map { height: calc(100vh - 300px); min-height: 380px; border-radius: var(--radius); border: 1px solid var(--border); }
.leaflet-popup-content { font-size: .9rem; }
.leaflet-popup-content a { color: var(--accent); }

.site-footer {
  max-width: 720px; margin: 0 auto; padding: 16px; color: var(--muted);
  font-size: .82rem; border-top: 1px solid var(--border);
}
.site-footer a { color: var(--accent); }

dialog#about-dialog {
  max-width: 560px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); padding: 20px;
}
dialog#about-dialog::backdrop { background: rgba(0,0,0,.5); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
