:root {
  --ink: #2b2420; --sub: #7a6a60; --line: #eadfd6;
  --shu: #d94a35;        /* 朱 */
  --shu-deep: #b4321f;
  --gold: #e8b64a;
  --kin: #f6d58a;
  --paper: #fff8f0; --card: #ffffff; --tint: #fbe9e1; --tint2: #fdf3d8;
  --radius: 1rem; --shadow: 0 6px 20px rgba(120, 60, 30, .10);
  --tap: 44px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
html, body { margin: 0; }
body {
  font-family: "Hiragino Maru Gothic ProN", "BIZ UDPGothic", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  color: var(--ink); line-height: 1.7;
  background: var(--paper) radial-gradient(circle at 20% -10%, var(--tint2) 0, transparent 40%),
              radial-gradient(circle at 110% 10%, var(--tint) 0, transparent 35%);
  background-attachment: fixed;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--shu-deep); }
.container { max-width: 44rem; margin: 0 auto; padding: 0 1rem; }

/* header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem;
  background: linear-gradient(135deg, var(--shu) 0%, #e8674f 60%, var(--gold) 140%);
  color: #fff; box-shadow: 0 2px 12px rgba(180, 50, 31, .25);
}
.brand { font-size: 1.25rem; letter-spacing: .15em; text-decoration: none; color: #fff; font-weight: 700; display: inline-flex; align-items: center; gap: .4rem; min-height: var(--tap); }
.brand .torii { display: inline-block; animation: sway 4s ease-in-out infinite; transform-origin: bottom center; }
.crumbs { color: rgba(255,255,255,.9); font-size: .8rem; overflow-x: auto; white-space: nowrap; flex: 1; scrollbar-width: none; }
.crumbs::-webkit-scrollbar { display: none; }
.crumbs a { color: #fff; }

/* type */
h1 { font-size: 1.5rem; font-weight: 800; margin: 1.4rem 0 .4rem; line-height: 1.35; }
h2 { font-size: 1.1rem; font-weight: 700; margin: 1.4rem 0 .5rem; }
h2::before { content: "⛩ "; opacity: .6; font-size: .9em; }
.lead { color: var(--sub); margin-top: 0; }
.note { color: var(--sub); font-size: .85rem; }

/* hero */
.hero { text-align: center; padding: 1.2rem 0 .2rem; }
.hero h1 { font-size: clamp(1.5rem, 6vw, 2.2rem); margin: .4rem 0; background: linear-gradient(90deg, var(--shu-deep), var(--shu) 60%, #c98a1a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { font-size: 1rem; }
.home-hero { text-align: center; padding: 1.5rem 0 .4rem; }
.eyebrow { color: var(--shu-deep); font-size: .85rem; font-weight: 800; letter-spacing: .12em; margin: 0; }
.home-hero h1 { font-size: clamp(1.7rem, 7vw, 2.5rem); margin: .3rem 0 .5rem; line-height: 1.35; }
.home-location { margin-top: .8rem; }
.home-location h2 { font-size: 1.25rem; }
.home-location .note { margin: -.4rem 0 .8rem; }
.home-location .nearest { margin-bottom: 0; }
.home-nearest-map { height: 18rem; margin: .2rem -.2rem .8rem; border-radius: .7rem; overflow: hidden; }
.home-nearest-list { display: grid; gap: .5rem; }
.home-nearest-card { display: grid; gap: .05rem; padding: .7rem .8rem; margin-top: .5rem; border-radius: .7rem; background: #fff; color: var(--ink); text-decoration: none; border: 1px solid var(--line); }
.home-nearest-card:first-child { border: 2px solid var(--shu); }
.home-nearest-card strong { color: var(--shu-deep); font-size: .78rem; }
.home-nearest-card span { font-weight: 800; }
.home-nearest-card small { color: var(--sub); }
.home-choices { display: grid; gap: .7rem; margin: 1.2rem 0; }
.home-choice { display: grid; grid-template-columns: 2.5rem 1fr auto; align-items: center; gap: .7rem; min-height: 4.4rem; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); }
.home-choice-icon { display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: .7rem; background: var(--tint2); font-size: 1.3rem; }
.home-choice strong, .home-choice small { display: block; }
.home-choice small { color: var(--sub); font-size: .82rem; }
.home-choice > span:last-child { color: var(--shu-deep); font-size: 1.5rem; }
.home-about { margin: 1.5rem 0; }
.page-switch { text-align: center; margin: 1.2rem 0; }
.area-list { list-style: none; padding: 0; display: grid; gap: .6rem; }
.area-list li { background: var(--card); border-radius: .7rem; box-shadow: var(--shadow); }
.area-list a { display: flex; align-items: center; justify-content: space-between; gap: .7rem; min-height: var(--tap); padding: .75rem 1rem; color: var(--ink); text-decoration: none; }
.area-list span { color: var(--sub); font-size: .85rem; }
.pref-list { margin-top: 1.2rem; }

/* map */
.map-wrap { position: relative; margin: .8rem 0; }
.map { width: 100%; height: auto; display: block; aspect-ratio: 8 / 7; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); touch-action: manipulation; }
.map path { fill: #efe6dc; stroke: #fff; stroke-width: .8; transition: fill .2s, transform .2s; }
.map path.available { fill: #f0a58f; cursor: pointer; }
.map path.reveal.available { animation: pop .5s cubic-bezier(.2,.9,.3,1.3) forwards, pulse 2.4s ease-in-out .6s infinite; }
.map path.available:hover, .map path.available:active { fill: var(--shu); animation: none; }
#pref-map { aspect-ratio: 4 / 3; }
.map path.muni { fill: #f3c9ba; stroke: #fff; stroke-width: 1; cursor: pointer; }
.map path.muni { cursor: default; }
.map path.reveal { opacity: 1; }
.map path.empty { fill: #efe6dc; cursor: default; }
.map text { font-size: 13px; font-weight: 700; pointer-events: none; fill: #4a3a30; paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; }
.map-status { text-align: center; }
.map .reveal { opacity: 0; animation: pop .5s cubic-bezier(.2,.9,.3,1.3) forwards; }
.shrine-pins { pointer-events: auto; }
.shrine-pin { color: var(--shu-deep); cursor: pointer; outline: none; }
.shrine-pin circle { fill: var(--shu); stroke: #fff; stroke-width: 1.5px; transition: r .15s, fill .15s; }
.shrine-pin:hover circle, .shrine-pin:focus circle { fill: var(--gold); r: 7; }
.cluster-pin circle { fill: var(--shu-deep); }
.cluster-pin text { fill: #fff; font-size: 11px; font-weight: 800; text-anchor: middle; pointer-events: none; }
.municipality-boundary { fill: #f3c9ba; stroke: #fff; stroke-width: 1.5; }
.user-location { fill: #2474d1; stroke: #fff; stroke-width: 3px; animation: location-pulse 1.8s ease-out infinite; }
.map-controls { position: absolute; z-index: 2; top: .7rem; right: .7rem; display: grid; gap: .35rem; }
.map-controls button { width: 2.6rem; height: 2.6rem; border: 1px solid var(--line); border-radius: .6rem; background: rgba(255,255,255,.94); color: var(--ink); font: inherit; font-size: 1.35rem; font-weight: 800; line-height: 1; box-shadow: 0 2px 8px rgba(60,35,20,.16); cursor: pointer; }
.map-controls button:active { transform: scale(.94); background: var(--tint); }
.map-popup { position: absolute; z-index: 3; transform: translate(-50%, calc(-100% - 12px)); max-width: min(15rem, calc(100% - 1rem)); min-width: 10rem; filter: drop-shadow(0 5px 12px rgba(60, 35, 20, .2)); }
.map-popup::after { content: ""; position: absolute; left: 50%; bottom: -9px; margin-left: -8px; border: 8px solid transparent; border-top-color: var(--card); border-bottom: 0; }
.map-popup a { display: block; color: var(--ink); background: var(--card); border: 2px solid var(--shu); border-radius: .7rem; padding: .65rem .8rem; text-decoration: none; }
.map-popup strong, .map-popup span { display: block; }
.map-popup span { color: var(--sub); font-size: .78rem; margin-top: .15rem; }
.map-popup small { display: block; color: var(--shu-deep); font-size: .75rem; margin-top: .35rem; }
.location-panel, .nearest { background: var(--card); border-radius: var(--radius); padding: 1rem 1.1rem; margin: 1rem 0; box-shadow: var(--shadow); }
.location-panel h2, .nearest h2 { margin-top: 0; }
.location-btn { width: 100%; min-height: var(--tap); border: 0; border-radius: 999px; padding: .5rem 1rem; font: inherit; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--shu), var(--shu-deep)); cursor: pointer; }
.location-btn:active { transform: scale(.98); }
.location-status { min-height: 1.5em; margin-bottom: 0; }
.nearest { border: 2px solid var(--kin); background: linear-gradient(160deg, #fff 0%, var(--tint2) 100%); }
.nearest-link { display: block; color: var(--ink); font-weight: 800; font-size: 1.05rem; }
.nearby-sheet { background: var(--card); border-radius: var(--radius); padding: 1rem 1.1rem; margin: 1rem 0; box-shadow: var(--shadow); }
.nearby-sheet h2 { margin-top: 0; }
.nearby-cards { display: flex; gap: .6rem; overflow-x: auto; padding: .15rem .1rem .35rem; scroll-snap-type: x proximity; }
.nearby-card { flex: 0 0 min(12rem, 72vw); min-height: 4.4rem; display: flex; flex-direction: column; justify-content: center; gap: .15rem; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: .7rem; background: linear-gradient(135deg, #fff, var(--tint2)); color: var(--ink); text-decoration: none; scroll-snap-align: start; }
.nearby-card span { color: var(--shu-deep); font-size: .82rem; font-weight: 700; }
.cluster-sheet { background: var(--card); border: 2px solid var(--kin); border-radius: var(--radius); padding: 1rem 1.1rem; margin: 1rem 0; box-shadow: var(--shadow); }
.cluster-sheet h2 { margin-top: 0; }
.cluster-cards { display: grid; gap: .5rem; }
.cluster-card { display: flex; align-items: center; justify-content: space-between; gap: .7rem; min-height: var(--tap); padding: .55rem .75rem; border-radius: .6rem; background: var(--tint2); color: var(--ink); text-decoration: none; }
.cluster-card span { color: var(--sub); font-size: .78rem; text-align: right; }
@media (max-width: 40rem) {
  .map-popup { left: 0 !important; right: 0; bottom: 0; top: auto !important; width: 100%; max-width: none; min-width: 0; transform: none; filter: drop-shadow(0 -4px 12px rgba(60,35,20,.16)); }
  .map-popup::after { display: none; }
  .map-popup a { border-width: 2px 0 0; border-radius: 0; padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom)); }
}

/* chips (tap targets ≥ 44px) */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; list-style: none; }
.chips li a {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: .3rem 1rem;
  border-radius: 999px; background: var(--card); text-decoration: none; color: var(--ink); font-weight: 600;
  box-shadow: 0 2px 8px rgba(120,60,30,.08); transition: transform .15s, box-shadow .15s, background .15s;
}
.chips li a:hover, .chips li a:active { transform: translateY(-2px) scale(1.03); background: var(--tint); box-shadow: 0 6px 16px rgba(180,50,31,.18); }
.chips li a .n { color: var(--shu-deep); font-size: .8rem; margin-left: .4rem; background: var(--tint2); border-radius: 999px; padding: 0 .5rem; }
.chips li.empty a { color: #b8aaa0; background: transparent; box-shadow: none; pointer-events: none; font-weight: 400; }

/* cards */
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
.card {
  background: var(--card); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow);
  position: relative; overflow: hidden; animation: rise .5s ease both;
  transition: transform .15s, box-shadow .15s;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: linear-gradient(var(--shu), var(--gold)); }
.card:hover, .card:active { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(180,50,31,.16); }
.card a.title { font-size: 1.1rem; text-decoration: none; color: var(--ink); font-weight: 700; display: block; min-height: 1.5rem; }
.card a.title::after { content: ""; position: absolute; inset: 0; }
.card .meta { color: var(--sub); font-size: .85rem; margin-top: .3rem; }
.cards .card:nth-child(n+2) { animation-delay: .05s; } .cards .card:nth-child(n+3) { animation-delay: .1s; }
.cards .card:nth-child(n+5) { animation-delay: .15s; } .cards .card:nth-child(n+8) { animation-delay: .2s; }

.badge { display: inline-block; font-size: .72rem; padding: .1rem .55rem; border-radius: .4rem; background: #f1ebe4; color: #6b5a50; margin-left: .4rem; vertical-align: middle; font-weight: 600; }
.badge.inferred { background: var(--tint2); color: #8a5a10; }

/* deity & facts */
.deity { background: var(--card); border-radius: var(--radius); padding: 1rem 1.1rem; margin: 1rem 0; box-shadow: var(--shadow); animation: rise .5s ease both; }
.deity h2 { margin-top: 0; }
.virtues { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; padding: 0; margin: .6rem 0; }
.virtues li { background: linear-gradient(135deg, var(--tint2), var(--kin)); padding: .2rem .7rem; border-radius: 999px; font-size: .85rem; font-weight: 600; color: #6a4a10; }
dl.facts { display: grid; grid-template-columns: 1fr; gap: .2rem; margin: 0 0 1rem; background: var(--card); border-radius: var(--radius); padding: .8rem 1rem; box-shadow: var(--shadow); }
dl.facts dt { color: var(--sub); font-size: .8rem; }
dl.facts dd { margin: 0 0 .4rem; }
@media (min-width: 40rem) { dl.facts { grid-template-columns: 6rem 1fr; gap: .3rem .8rem; } dl.facts dt { font-size: inherit; } }
.route-box { display: grid; gap: .25rem; margin: 0 0 1.2rem; }
.route-link { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: .55rem 1rem; border-radius: 999px; background: linear-gradient(135deg, var(--shu), var(--shu-deep)); color: #fff; text-decoration: none; font-weight: 700; box-shadow: 0 4px 12px rgba(180,50,31,.25); }
.route-link:hover { transform: translateY(-1px); }
.route-box .note { margin: 0 .3rem; }

/* fortune */
.fortune {
  background: linear-gradient(160deg, #fff 0%, var(--tint2) 100%);
  border-radius: var(--radius); padding: 1.1rem 1.1rem 1.2rem; margin: 1.4rem 0; box-shadow: var(--shadow);
  border: 2px solid var(--kin);
}
.fortune h2 { margin-top: 0; }
.fortune h2::before { content: "🎴 "; }
.draw-btn {
  display: flex; align-items: center; justify-content: center; gap: .5rem; width: 100%; min-height: 56px;
  border: 0; border-radius: 999px; font: inherit; font-weight: 800; font-size: 1.05rem; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, var(--shu), var(--shu-deep)); box-shadow: 0 6px 18px rgba(180,50,31,.35);
  transition: transform .15s, box-shadow .15s;
}
.draw-btn:hover { transform: translateY(-2px); } .draw-btn:active { transform: scale(.97); }
.draw-btn .box { display: inline-block; font-size: 1.4rem; }
.draw-btn.shaking .box { animation: shake .6s ease-in-out; }
.fortune-body { display: none; }
.fortune-body.open { display: block; animation: unfold .6s cubic-bezier(.2,.9,.3,1.2) both; }
.fortune .opener { font-size: 1.15rem; font-weight: 700; margin: .8rem 0 .4rem; }
.focus { display: inline-block; background: var(--shu); color: #fff; border-radius: 999px; padding: .15rem .8rem; font-weight: 700; }
.hints { display: grid; grid-template-columns: 1fr; gap: .5rem; margin: 1rem 0; padding: 0; }
.hints div { background: rgba(255,255,255,.8); border-radius: .7rem; padding: .6rem .8rem; animation: rise .5s ease both; }
.hints dt { color: var(--shu-deep); font-weight: 800; font-size: .85rem; }
.hints dd { margin: .1rem 0 0; }
.fortune .action { background: var(--card); border-left: 4px solid var(--gold); padding: .6rem .9rem; border-radius: .6rem; font-weight: 600; }
.share { display: flex; gap: .5rem; margin-top: .8rem; }
.share a, .share button { flex: 1; min-height: var(--tap); display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; border: 2px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font: inherit; font-weight: 600; cursor: pointer; }

/* footer */
.site-footer { margin-top: 3rem; padding: 1.2rem 1rem 2rem; font-size: .8rem; color: var(--sub); border-top: 1px solid var(--line); background: rgba(255,255,255,.6); }
.site-footer .caution { color: var(--ink); font-size: .85rem; margin: 0 0 .6rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.site-footer nav a { min-height: var(--tap); display: inline-flex; align-items: center; }

/* about page */
.about section { background: var(--card); border-radius: var(--radius); padding: 1rem 1.1rem; margin: .8rem 0; box-shadow: var(--shadow); }

/* evidence review */
.review-page { padding-bottom: 2rem; }
.review-filter, .review-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem; padding: .8rem; margin: .8rem 0; background: var(--card); border: 1px solid var(--line); border-radius: .8rem; }
.review-filter label { display: grid; gap: .2rem; color: var(--sub); font-size: .78rem; font-weight: 700; }
.review-filter select, .review-filter input, .review-toolbar select { min-height: 2.75rem; border: 1px solid var(--line); border-radius: .5rem; padding: .4rem .55rem; background: #fff; color: var(--ink); font: inherit; }
.review-search { flex: 1 1 12rem; }
.review-search input { width: 100%; }
.review-button { min-height: 2.75rem; border: 0; border-radius: .55rem; padding: .45rem .8rem; background: var(--shu); color: #fff; font: inherit; font-weight: 800; cursor: pointer; }
.review-button.secondary { background: var(--ink); }
.review-toolbar { align-items: center; position: sticky; top: 4.1rem; z-index: 4; box-shadow: var(--shadow); }
.review-toolbar > span { color: var(--sub); font-size: .8rem; margin-right: auto; }
.review-list { display: grid; gap: .65rem; }
.review-item { display: grid; grid-template-columns: 2rem 1fr; gap: .5rem; padding: .85rem; background: var(--card); border-radius: .8rem; box-shadow: var(--shadow); border-left: 4px solid var(--gold); }
.review-check { padding-top: .3rem; }
.review-check input, .review-toolbar input { width: 1.2rem; height: 1.2rem; accent-color: var(--shu); }
.review-heading { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: 1.05rem; }
.review-badge { color: var(--shu-deep); background: var(--tint); border-radius: 999px; padding: .1rem .55rem; font-size: .72rem; }
.review-facts { display: grid; grid-template-columns: 4rem 1fr; gap: .1rem .5rem; margin: .45rem 0; font-size: .78rem; }
.review-facts dt { color: var(--sub); }
.review-facts dd { margin: 0; }
.review-value { padding: .55rem .7rem; margin: .5rem 0; background: var(--paper); border-radius: .5rem; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .88rem; }
.review-body a { font-size: .82rem; }
.review-empty { padding: 2rem 1rem; text-align: center; color: var(--sub); background: var(--card); border-radius: .8rem; }
.review-message { padding: .6rem .8rem; border-radius: .6rem; background: var(--tint2); }
.review-pagination { display: flex; justify-content: center; gap: 1rem; align-items: center; margin: 1.2rem 0; }
.review-pagination a { min-height: var(--tap); display: inline-flex; align-items: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* animations */
@keyframes pulse { 0%,100% { fill: #f0a58f; } 50% { fill: #e77d64; } }
@keyframes pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes sway { 0%,100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes shake { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-18deg); } 40% { transform: rotate(16deg); } 60% { transform: rotate(-12deg); } 80% { transform: rotate(8deg); } }
@keyframes unfold { from { opacity: 0; transform: translateY(14px) scaleY(.9); } to { opacity: 1; transform: none; } }
@keyframes location-pulse { 0% { r: 7; opacity: 1; } 70%,100% { r: 15; opacity: .15; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .map .reveal { opacity: 1; }
}
