:root {
  --ink: #1f2933;
  --muted: #5f6b76;
  --paper: #fffdf9;
  --panel: #ffffff;
  --line: #e1ddd5;
  --brand: #254f6f;
  --brand-dark: #17384f;
  --shrine: #b94a3b;
  --temple: #6556a3;
  --shadow: 0 12px 32px rgba(34, 52, 66, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
  line-height: 1.7;
}
a { color: var(--brand); }
button, input, select { font: inherit; }

.site-header {
  color: #fff;
  background:
    linear-gradient(120deg, rgba(23, 56, 79, .96), rgba(37, 79, 111, .91)),
    radial-gradient(circle at 85% 20%, rgba(255,255,255,.16), transparent 42%);
  border-bottom: 5px solid #d9c39a;
}
.header-inner, main, footer { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.header-inner { padding: 24px 0 38px; }
.crumbs { display: flex; gap: 10px; flex-wrap: wrap; font-size: .86rem; }
.crumbs a { color: #fff; text-underline-offset: 3px; }
.eyebrow, .section-kicker { margin: 24px 0 4px; font-size: .75rem; font-weight: 800; letter-spacing: .16em; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1.2; letter-spacing: .02em; }
.lead { max-width: 780px; margin: 14px 0 3px; font-size: 1.05rem; }
.version { margin: 0; color: #e3edf4; font-size: .88rem; }
.jump-links { display: flex; gap: 12px; margin-top: 22px; }
.jump-links a { padding: 8px 15px; color: #fff; text-decoration: none; border: 1px solid rgba(255,255,255,.5); border-radius: 999px; }

main { padding: 28px 0 56px; }
.about-card, .map-section, .list-section { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.about-card { margin-bottom: 24px; }
.about-card summary { cursor: pointer; padding: 16px 20px; font-weight: 800; }
.about-body { padding: 0 20px 12px; color: var(--muted); }
.map-section, .list-section { padding: 20px; margin-bottom: 28px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.section-kicker { margin: 0; color: var(--brand); }
h2 { margin: 0; font-size: 1.55rem; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .9rem; }
.legend span { display: inline-flex; gap: 7px; align-items: center; }
.legend-dot { width: 13px; height: 13px; border-radius: 50%; display: inline-block; }
.legend-dot.shrine { background: var(--shrine); }
.legend-dot.temple { background: var(--temple); }

#map { height: min(68vh, 660px); min-height: 470px; border-radius: 12px; border: 1px solid #ced8de; overflow: hidden; }
.map-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.map-actions button, .reset { border: 1px solid #b9c4cc; background: #fff; color: var(--brand-dark); border-radius: 9px; padding: 8px 13px; cursor: pointer; font-weight: 700; }
.map-actions button:hover, .reset:hover { background: #f1f6f8; }
#locationStatus { color: var(--muted); font-size: .88rem; }

.site-marker { background: transparent; border: 0; }
.marker-badge {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50% 50% 50% 7px;
  transform: rotate(-45deg);
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 3px 10px rgba(0,0,0,.32);
  font-weight: 900;
}
.marker-badge span { transform: rotate(45deg); font-size: 14px; }
.marker-badge.shrine { background: var(--shrine); }
.marker-badge.temple { background: var(--temple); }

.popup { min-width: 220px; }
.popup-title { margin: 0 0 5px; font-size: 1.05rem; line-height: 1.35; }
.popup-type { display: inline-block; margin-bottom: 7px; padding: 1px 8px; color: #fff; border-radius: 999px; font-size: .75rem; font-weight: 800; }
.popup-type.shrine { background: var(--shrine); }
.popup-type.temple { background: var(--temple); }
.popup-address, .popup-extra { margin: 4px 0; }
.popup-route { display: inline-block; margin-top: 8px; padding: 6px 11px; border-radius: 8px; color: #fff !important; background: var(--brand); text-decoration: none; font-weight: 800; }
.popup-route:hover { background: var(--brand-dark); }

.filters { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 12px; align-items: end; padding: 14px; background: #f5f7f8; border-radius: 12px; }
.filters label { display: grid; gap: 4px; font-size: .82rem; font-weight: 800; }
.filters input, .filters select { width: 100%; min-height: 43px; padding: 8px 10px; border: 1px solid #bfc9d0; border-radius: 8px; background: #fff; }
.count { color: var(--brand); font-size: 1.05rem; }
.site-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.site-card { display: grid; grid-template-columns: auto 1fr; gap: 12px; width: 100%; padding: 14px; text-align: left; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.site-card:hover, .site-card:focus-visible { border-color: #8aa4b5; box-shadow: 0 8px 18px rgba(34,52,66,.08); outline: none; }
.site-symbol { display: grid; place-items: center; width: 38px; height: 38px; color: #fff; border-radius: 50%; font-weight: 900; }
.site-symbol.shrine { background: var(--shrine); }
.site-symbol.temple { background: var(--temple); }
.site-name { display: block; font-weight: 800; }
.site-address { display: block; margin-top: 3px; color: var(--muted); font-size: .88rem; }
.site-meta { display: block; color: var(--muted); font-size: .78rem; }
.empty { grid-column: 1 / -1; padding: 30px; text-align: center; color: var(--muted); }

footer { padding: 0 0 46px; color: var(--muted); font-size: .85rem; }
footer nav { display: flex; gap: 14px; flex-wrap: wrap; }

@media (max-width: 760px) {
  .header-inner, main, footer { width: min(100% - 20px, 1120px); }
  .header-inner { padding-top: 16px; }
  .map-section, .list-section { padding: 12px; border-radius: 12px; }
  #map { min-height: 410px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters label:first-child, .reset { grid-column: 1 / -1; }
  .site-list { grid-template-columns: 1fr; }
}
