:root {
  --ink: #f5efe1;
  --ink-soft: #d9cfb6;
  --muted: #a9aa93;
  --night: #10130f;
  --forest: #18241b;
  --moss: #314332;
  --gold: #d8b766;
  --amber: #a96f34;
  --line: rgba(245, 239, 225, 0.16);
  --line-strong: rgba(216, 183, 102, 0.36);
  --glass: rgba(16, 19, 15, 0.82);
  --serif: "Yu Mincho", "Hiragino Mincho ProN", serif;
  --sans: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--ink); font-family: var(--sans); overflow: hidden; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; }
a { color: var(--gold); }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 55%, transparent 55%, rgba(8, 10, 8, 0.7) 100%); }

/* ---- 上部バー ---- */
.bar { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 0; pointer-events: none; z-index: 5; }
.bar > * { pointer-events: auto; }
.eyebrow { display: block; font-size: 10px; letter-spacing: 0.32em; color: var(--gold); }
h1 { margin: 2px 0 0; font: 600 17px/1.3 var(--serif); letter-spacing: 0.06em; text-shadow: 0 1px 10px #000; }
h1 small { display: block; font: 400 11px var(--sans); color: var(--ink-soft); letter-spacing: 0.1em; margin-top: 2px; }
.ghost { background: rgba(16, 19, 15, 0.6); border: 1px solid var(--line-strong); border-radius: 999px; padding: 9px 14px; font-size: 12px; min-height: 40px; cursor: pointer; backdrop-filter: blur(6px); }
.ghost:hover, .ghost:focus-visible { border-color: var(--gold); outline: none; }

/* ---- 光の名札 ---- */
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
.lbl { position: absolute; left: 0; top: 0; font: 12px var(--serif); letter-spacing: 0.08em; color: var(--ink-soft); white-space: nowrap; text-shadow: 0 0 6px #000, 0 0 12px #000; transition: opacity 0.6s; will-change: transform; }
.lbl.sel { color: var(--gold); }

.hint { position: fixed; left: 50%; bottom: calc(104px + var(--safe-b)); transform: translateX(-50%); font-size: 12px; color: var(--ink-soft); letter-spacing: 0.1em; background: rgba(16,19,15,0.55); padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); transition: opacity 1s; z-index: 3; white-space: nowrap; }
.hint.off { opacity: 0; pointer-events: none; }

/* ---- 下の神社チップ（スマホで押しやすい大きさ） ---- */
.chips { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; padding: 10px 12px calc(14px + var(--safe-b)); overflow-x: auto; scrollbar-width: none; z-index: 4; background: linear-gradient(to top, rgba(8,10,8,0.85), transparent); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; min-height: 44px; padding: 0 16px; border-radius: 999px; background: rgba(16,19,15,0.72); border: 1px solid var(--line-strong); font: 13px var(--serif); letter-spacing: 0.06em; cursor: pointer; white-space: nowrap; }
.chip::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px 2px rgba(216,183,102,0.7); vertical-align: 1px; }
.chip.on, .chip:hover, .chip:focus-visible { border-color: var(--gold); background: rgba(49,67,50,0.8); outline: none; }
body.open .chips { display: none; }
body.open .hint { display: none; }

.back { position: fixed; left: 12px; top: calc(62px + env(safe-area-inset-top, 0px)); z-index: 6; min-height: 40px; padding: 0 14px; border-radius: 999px; background: rgba(16,19,15,0.7); border: 1px solid var(--line-strong); font-size: 12px; cursor: pointer; backdrop-filter: blur(6px); }

/* ---- 夜空に浮かぶ写真 ---- */
.photo { position: fixed; z-index: 6; margin: 0; left: 50%; top: calc(104px + env(safe-area-inset-top, 0px)); width: min(84vw, 340px); transform: translate(-50%, 24px) scale(0.96); opacity: 0; transition: opacity 1.6s ease, transform 2.2s cubic-bezier(.2,.7,.2,1), top .6s ease, width .6s ease; filter: drop-shadow(0 0 28px rgba(216,183,102,0.28)); pointer-events: none; }
.photo.show { opacity: 1; transform: translate(-50%, 0) scale(1); animation: floaty 7s ease-in-out infinite 2.4s; }
@keyframes floaty { 0%,100% { translate: 0 0; } 50% { translate: 0 -6px; } }
.ph-frame { position: relative; aspect-ratio: 4 / 3; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; background: linear-gradient(160deg, #1d2a22, #0e1210); }
.ph-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-frame svg { width: 100%; height: 100%; display: block; }
.ph-tag { position: absolute; left: 8px; top: 8px; right: 8px; font-size: 10.5px; line-height: 1.4; color: var(--ink); background: rgba(16,19,15,0.78); padding: 4px 8px; border-radius: 4px; border: 1px solid var(--line-strong); }
.photo figcaption { margin-top: 6px; font-size: 10.5px; color: var(--ink-soft); line-height: 1.5; text-shadow: 0 1px 6px #000; }
.photo.compact { left: auto; right: 12px; top: calc(132px + env(safe-area-inset-top, 0px)); width: min(40vw, 190px); transform: none; }
.photo.compact figcaption { display: none; }
.photo.compact .ph-tag { font-size: 9px; padding: 2px 5px; }
/* AIイメージ図の札：絵を隠さないよう、左下の隅に小さく置く（全文は絵の下の説明文に出す） */
.ph-tag.ai { top: auto; bottom: 6px; left: 6px; right: auto; font-size: 9.5px; line-height: 1.2; padding: 1px 6px; background: rgba(16,19,15,0.6); }
.photo.compact .ph-tag.ai { font-size: 8.5px; padding: 1px 5px; bottom: 4px; left: 4px; }

/* ---- 項目リスト（スマホ: 下からのシート / PC: 右の列） ---- */
.sheet { position: fixed; z-index: 7; left: 0; right: 0; bottom: 0; height: 56vh; height: 56dvh; background: var(--glass); backdrop-filter: blur(10px); border-top: 1px solid var(--line-strong); border-radius: 16px 16px 0 0; transform: translateY(100%); transition: transform 1.1s cubic-bezier(.2,.7,.2,1); display: flex; flex-direction: column; }
.sheet.show { transform: translateY(0); }
.sheet .grab { width: 44px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 8px auto 2px; flex: 0 0 auto; }
#sheetBody { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 16px calc(28px + var(--safe-b)); overscroll-behavior: contain; }
.sheet h2 { margin: 6px 0 0; font: 600 22px/1.3 var(--serif); letter-spacing: 0.06em; }
.sheet h2 small { display: block; font: 400 12px var(--sans); color: var(--muted); letter-spacing: 0.08em; margin-top: 2px; }
.sheet h3 { margin: 20px 0 6px; font: 600 13px var(--sans); letter-spacing: 0.14em; color: var(--gold); border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.sheet p, .sheet li { font-size: 14px; line-height: 1.8; color: var(--ink-soft); }
.sheet p { margin: 6px 0; }
.sheet ul { margin: 6px 0; padding-left: 1.2em; }
.sheet .meta { font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.badge { display: inline-block; font-size: 10.5px; line-height: 1; padding: 3px 6px; border-radius: 3px; margin-right: 6px; vertical-align: 1px; letter-spacing: 0.04em; }
.badge.fact { background: rgba(49,67,50,0.9); border: 1px solid #5d7a5f; }
.badge.trad { background: rgba(169,111,52,0.25); border: 1px solid var(--amber); }
.badge.guess { background: rgba(115,54,46,0.4); border: 1px solid #a5584d; }
.badge.todo { background: rgba(115,54,46,0.4); border: 1px solid #a5584d; color: #ffd6cc; }
.badge.pr { background: #3a2b14; border: 1px solid var(--gold); color: var(--gold); }
.sup { font-size: 10px; vertical-align: super; color: var(--gold); margin-left: 1px; }
.deities { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.dchip { min-height: 44px; padding: 6px 14px; border-radius: 8px; background: rgba(49,67,50,0.55); border: 1px solid var(--line-strong); cursor: pointer; text-align: left; font: 15px var(--serif); line-height: 1.3; }
.dchip small { display: block; font: 11px var(--sans); color: var(--muted); }
.dchip:hover, .dchip:focus-visible { border-color: var(--gold); outline: none; }
.row { display: grid; grid-template-columns: 5.5em 1fr; gap: 4px 10px; font-size: 14px; line-height: 1.7; }
.row dt { color: var(--muted); font-size: 12.5px; }
.row dd { margin: 0; color: var(--ink-soft); }
.prbox.stays { border-style: solid; }
.selbox { border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px 12px; margin: 8px 0; background: rgba(24,36,27,0.55); }
.selbox .selreason { margin: 0 0 6px; color: var(--ink); }
.selbox dl { margin: 6px 0 0; }
.selbox dt { font: 12px var(--sans); color: var(--gold); margin-top: 10px; }
.selbox dd { margin: 2px 0 0; font-size: 14px; line-height: 1.8; color: var(--ink-soft); }
.selbox details { margin: 10px 0 0; }
.selbox summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font: 13px var(--sans); color: var(--muted); }
.selbox ul { margin: 0 0 4px; padding-left: 1.2em; }
.selbox li { font-size: 13px; line-height: 1.7; color: var(--ink-soft); }
.selbox .meta { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.staylist { list-style: none; padding: 0; margin: 6px 0; }
.staylist li { margin: 6px 0; padding: 8px 10px; background: rgba(49,67,50,0.4); border: 1px solid var(--line); border-radius: 8px; }
.staylist a { display: block; min-height: 24px; font: 14px var(--serif); }
.staylist small { display: block; font: 11px var(--sans); color: var(--muted); margin-top: 2px; }
.foodlist { list-style: none; padding: 0; margin: 6px 0; }
.foodlist li { margin: 6px 0; padding: 8px 10px; background: rgba(49,67,50,0.4); border: 1px solid var(--line); border-radius: 8px; }
.foodlist .fname { display: block; font: 14px var(--serif); }
.foodlist small { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; font: 12px var(--sans); color: var(--muted); margin-top: 4px; }
.foodlist small a { display: inline-flex; align-items: center; min-height: 32px; }
.badge.cand { margin-right: 6px; }
.prbox { border: 1px dashed var(--line-strong); border-radius: 8px; padding: 10px 12px; margin: 8px 0; font-size: 13px; color: var(--muted); }
.btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--gold); background: rgba(216,183,102,0.12); color: var(--ink); text-decoration: none; font-size: 14px; cursor: pointer; margin: 4px 8px 4px 0; }
.btn.off { border-color: var(--line); color: var(--muted); background: transparent; cursor: default; }
.linklist { list-style: none; padding: 0; }
.linklist li { margin: 6px 0; }
.linklist button { min-height: 44px; width: 100%; text-align: left; background: rgba(49,67,50,0.4); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; font: 14px var(--serif); }
.linklist button small { display: block; font: 11px var(--sans); color: var(--muted); }
.crumb { background: none; border: 0; color: var(--gold); font-size: 13px; padding: 10px 0; min-height: 44px; cursor: pointer; }
.src { font-size: 11.5px; color: var(--muted); line-height: 1.6; padding-left: 0; list-style: none; }
.src li { font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.src a { word-break: break-all; }
.quote { border-left: 2px solid var(--gold); padding: 2px 0 2px 12px; margin: 8px 0; color: var(--ink); font-family: var(--serif); }
.scene { background: rgba(24,36,27,0.7); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.scene b { font-family: var(--serif); color: var(--ink); }
svg.gene { width: 100%; height: auto; display: block; margin: 6px 0; }
svg.gene text { font-family: var(--serif); fill: var(--ink); }
svg.gene .nd rect { fill: rgba(24,36,27,0.9); stroke: var(--line-strong); }
svg.gene .nd.en rect { stroke: var(--gold); stroke-width: 1.6; fill: rgba(49,67,50,0.9); }
svg.gene .nd.me rect { stroke: var(--gold); stroke-width: 2.4; }
svg.gene .nd { cursor: pointer; }
svg.gene .ed { stroke: var(--muted); fill: none; stroke-width: 1; }
svg.gene .ed.sp { stroke-dasharray: 4 3; }

/* ---- 系譜図（全画面） ---- */
.tree { position: fixed; inset: 0; z-index: 9; background: rgba(8,10,8,0.94); display: flex; flex-direction: column; padding: calc(12px + env(safe-area-inset-top, 0px)) 14px calc(12px + var(--safe-b)); }
.tree-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tree h2 { margin: 0; font: 600 18px var(--serif); }
.tree h2 small { display: block; font: 11px var(--sans); color: var(--muted); }
.tree-note { font-size: 12px; color: var(--ink-soft); margin: 8px 0; }
.tree-body { flex: 1; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: rgba(16,19,15,0.6); -webkit-overflow-scrolling: touch; }
.tree-body svg { width: 100%; height: auto; max-width: none; }

.credit { position: fixed; right: 8px; bottom: 2px; z-index: 1; font-size: 9.5px; color: var(--muted); display: flex; flex-direction: column; align-items: flex-end; gap: 0; text-align: right; max-width: 70vw; pointer-events: auto; opacity: .75; }
.credit a { color: var(--ink-soft); }
body:not(.open) .credit { bottom: calc(64px + var(--safe-b)); left: 12px; right: 12px; max-width: none; align-items: center; text-align: center; }
body:not(.open) .credit span:nth-child(2) { display: none; }
.noscript { position: fixed; top: 80px; left: 16px; right: 16px; z-index: 20; }
.fail { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; z-index: 30; background: var(--night); }

/* ---- PC（横長） ---- */
@media (min-width: 880px) {
  h1 { font-size: 22px; }
  .bar { padding: 18px 28px 0; }
  .hint { bottom: 92px; }
  body:not(.open) .credit { left: auto; right: 8px; align-items: flex-end; text-align: right; max-width: 70vw; }
  body:not(.open) .credit span:nth-child(2) { display: block; }
  .chips { justify-content: center; padding-bottom: 22px; }
  .back { left: 28px; top: 82px; }
  .photo { left: auto; right: 4vw; top: 12vh; width: min(30vw, 400px); transform: translate(0, 24px) scale(0.96); }
  .photo.show { transform: none; }
  .sheet { left: auto; right: 0; top: 0; bottom: 0; width: min(38vw, 520px); height: auto; border-radius: 0; border-top: 0; border-left: 1px solid var(--line-strong); transform: translateX(100%); }
  .sheet.show { transform: translateX(0); }
  .sheet .grab { display: none; }
  #sheetBody { padding: 28px 28px 40px; }
  /* 写真は地図側（左寄り）に浮かべる */
  body.open .photo { right: auto; left: 5vw; top: auto; bottom: 9vh; width: min(30vw, 400px); }
  body.open .photo.compact { width: min(30vw, 400px); left: 5vw; right: auto; top: auto; bottom: 9vh; }
  body.open .photo.compact figcaption { display: block; }
  body.open .credit { right: auto; left: 8px; align-items: flex-start; text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .photo, .sheet { transition-duration: .01s; animation: none !important; }
}

.acts { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.lbl.you { color: #bfe6ff; }
.routebox { margin-top: 4px; }
.toast { position: fixed; z-index: 12; left: 50%; top: calc(112px + env(safe-area-inset-top, 0px)); transform: translate(-50%, -8px); width: min(88vw, 460px); text-align: center; font-size: 13px; line-height: 1.6; padding: 10px 14px; border-radius: 10px; background: rgba(16,19,15,0.92); border: 1px solid var(--line-strong); color: var(--ink); opacity: 0; transition: opacity .4s, transform .4s; pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.consent { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(6,8,6,0.78); }
.consent-box { width: min(94vw, 460px); max-height: 90vh; overflow-y: auto; background: #151a14; border: 1px solid var(--line-strong); border-radius: 12px; padding: 18px 18px 14px; }
.consent-box h2 { margin: 0 0 8px; font: 600 18px var(--serif); }
.consent-box p, .consent-box li { font-size: 13.5px; line-height: 1.75; color: var(--ink-soft); }
.consent-box ul { margin: 6px 0 12px; padding-left: 1.2em; }
.consent-box .btn { display: flex; width: 100%; justify-content: center; margin: 8px 0 0; }

.stop { position: fixed; z-index: 8; left: 50%; bottom: calc(22px + var(--safe-b)); transform: translateX(-50%); min-height: 46px; padding: 0 22px; border-radius: 999px; border: 1px solid var(--gold); background: rgba(16,19,15,0.82); font-size: 14px; letter-spacing: .08em; cursor: pointer; backdrop-filter: blur(6px); }
body.running .sheet.show { transform: translateY(100%); }
body.running .photo { opacity: 0 !important; }
body.running .hint, body.running .chips { display: none; }
@media (min-width: 880px) { body.running .sheet.show { transform: translateX(100%); } }

.hud { position: fixed; z-index: 8; left: 50%; top: calc(112px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); max-width: min(92vw, 560px); padding: 8px 18px; border-radius: 999px; background: rgba(16,19,15,0.84); border: 1px solid var(--line-strong); font: 600 15px/1.4 var(--serif); letter-spacing: .06em; color: var(--ink); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; backdrop-filter: blur(6px); box-shadow: 0 0 18px rgba(216,183,102,0.18); pointer-events: none; }
body.hasroute .photo.compact { top: calc(168px + env(safe-area-inset-top, 0px)); }
@media (min-width: 880px) { .hud { top: 22px; } body.hasroute .photo.compact { top: auto; } }
@media (max-width: 420px) { .hud { font-size: 13.5px; padding: 7px 12px; } }

/* ---- 章めくりの神社カード ---- */
.sheet.book #sheetBody { padding: 0; overflow: hidden; position: relative; display: flex; flex-direction: column; min-height: 0; flex: 1; }
.chapters { flex: 1; min-height: 0; overflow-y: auto; scroll-snap-type: y proximity; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; scroll-behavior: auto; }
.ch { min-height: var(--chh, 420px); scroll-snap-align: start; padding: 22px 46px 30px 20px; display: flex; flex-direction: column; justify-content: center; position: relative; }
.ch + .ch::before { content: ""; position: absolute; left: 20px; right: 46px; top: 0; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }
.ch p, .ch li { font-size: 15.5px; line-height: 1.95; }
.chh { font: 600 13px var(--sans); letter-spacing: .3em; color: var(--gold); margin: 0 0 14px; border: 0; padding: 0; }
.chh.sub { margin-top: 24px; letter-spacing: .14em; }
/* 出現の動き */
.rv { opacity: 0; transform: translateY(20px); transition: opacity .75s ease, transform .9s cubic-bezier(.2,.7,.2,1); transition-delay: calc(var(--i, 0) * 110ms + 120ms); }
.ch.in .rv { opacity: 1; transform: none; }
/* 1 はじまり */
.nm { margin: 0 0 6px; font: 600 clamp(34px, 9.5vw, 46px)/1.25 var(--serif); letter-spacing: .08em; }
.nm span { display: inline-block; opacity: 0; transform: translateY(14px) scale(1.06); filter: blur(7px); transition: opacity .8s ease, transform 1s cubic-bezier(.2,.7,.2,1), filter .9s ease; transition-delay: calc(var(--k) * 90ms + 80ms); }
.ch.in .nm span { opacity: 1; transform: none; filter: none; }
.nm .wd { opacity: 1; transform: none; filter: none; transition: none; }   /* 英語の名前の単語まとめ（中の1文字ずつがアニメーションする） */
.rd { color: var(--muted); font-size: 13px !important; letter-spacing: .1em; margin: 0 0 18px; }
.lead p { font: 500 19px/1.9 var(--serif) !important; color: var(--ink); }
.hintnext { margin-top: 26px !important; font-size: 12px !important; color: var(--muted); letter-spacing: .14em; display: flex; align-items: center; gap: 8px; }
.arw { display: inline-block; font-size: 18px; color: var(--gold); animation: arw 1.6s ease-in-out infinite; }
@keyframes arw { 0%, 100% { transform: translateY(2px); opacity: .5; } 50% { transform: translateY(-5px); opacity: 1; } }
/* 2 御祭神 */
.dcard { display: block; width: 100%; text-align: left; padding: 16px 18px; margin: 0 0 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: linear-gradient(135deg, rgba(49,67,50,.75), rgba(24,36,27,.85)); cursor: pointer; position: relative; overflow: hidden; }
.dcard::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(216,183,102,.16) 50%, transparent 70%); transform: translateX(-120%); transition: transform 1.4s ease; }
.ch.in .dcard::after { transform: translateX(120%); transition-delay: .7s; }
.dcard b { display: block; font: 600 25px/1.3 var(--serif); letter-spacing: .06em; }
.dcard small { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.dcard em { display: block; margin-top: 8px; font-style: normal; font-size: 13px; color: var(--gold); }
/* 3 由緒（時間の線） */
.tl { position: relative; padding-left: 26px; }
.tl::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--gold), rgba(216,183,102,.15)); transform: scaleY(0); transform-origin: top; transition: transform 1.6s cubic-bezier(.3,.7,.2,1) .2s; }
.ch.in .tl::before { transform: scaleY(1); }
.tli { position: relative; margin: 0 0 18px; }
.tli::before { content: ""; position: absolute; left: -26px; top: 9px; width: 14px; height: 14px; border-radius: 50%; background: var(--night); border: 2px solid var(--gold); box-shadow: 0 0 10px rgba(216,183,102,.5); }
.tli.tradition::before { border-color: var(--amber); }
.tli p { margin: 0; }
/* 4 見どころ */
.spot { padding: 14px 16px; margin: 0 0 12px; border-radius: 12px; background: rgba(49,67,50,.4); border: 1px solid var(--line); }
.spot p { margin: 0; }
/* 5 行き方 */
.bignum { display: flex; gap: 28px; margin: 6px 0 12px; }
.bignum b { font: 700 clamp(44px, 14vw, 64px)/1 var(--serif); color: var(--gold); letter-spacing: .02em; text-shadow: 0 0 22px rgba(216,183,102,.35); }
.bignum small { margin-left: 6px; font-size: 14px; color: var(--ink-soft); }
/* 章の目印（右） */
.dots { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 4px; z-index: 3; }
.dots button { width: 32px; height: 32px; padding: 0; border: 0; background: none; cursor: pointer; position: relative; }
.dots button::before { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px; border-radius: 50%; border: 1.5px solid var(--gold); transition: all .4s; }
.dots button.on::before { background: var(--gold); box-shadow: 0 0 10px 2px rgba(216,183,102,.6); transform: scale(1.35); }
.dots button span { position: absolute; right: 30px; top: 50%; transform: translateY(-50%); font-size: 11px; letter-spacing: .1em; white-space: nowrap; color: var(--ink); background: rgba(16,19,15,.85); padding: 3px 8px; border-radius: 4px; opacity: 0; transition: opacity .3s; pointer-events: none; }
.dots button.on span { opacity: .9; }
@media (max-width: 879px) { .sheet { height: 64vh; height: 64dvh; } }
@media (min-width: 880px) { .ch { padding: 40px 64px 40px 32px; } .ch + .ch::before { left: 32px; right: 64px; } .dots { right: 14px; } }
@media (prefers-reduced-motion: reduce) { .rv, .nm span { opacity: 1 !important; transform: none !important; filter: none !important; transition: none !important; } .tl::before { transform: none !important; transition: none !important; } .arw { animation: none; } }
@media (max-width: 879px) { .dots button span { display: none; } }

/* ---- 絵巻（年表） ---- */
.emaki { position: fixed; inset: 0; z-index: 14; background: radial-gradient(ellipse at 30% 40%, #1b2419 0%, #0a0d0a 70%); }
.emaki-x { position: absolute; right: 14px; top: calc(12px + env(safe-area-inset-top, 0px)); z-index: 3; }
.track { position: absolute; inset: 0; display: flex; align-items: center; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; padding: 0 8vw; gap: 4vw; scrollbar-width: none; }
.track::-webkit-scrollbar { display: none; }
.ink { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.ink path { fill: none; stroke: var(--gold); stroke-width: 2.4; stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(216,183,102,.7)); opacity: .85; }
.ink circle { fill: #fff3cf; filter: drop-shadow(0 0 10px rgba(255,236,170,.95)); }
.sp { position: relative; z-index: 1; flex: 0 0 auto; width: min(84vw, 440px); max-height: 82vh; overflow-y: auto; scroll-snap-align: center; padding: 18px 8px; }
.sp .when { font: 700 clamp(30px, 9vw, 46px)/1.25 var(--serif); letter-spacing: .06em; color: var(--gold); text-shadow: 0 0 24px rgba(216,183,102,.4); margin: 0 0 14px; }
.sp .when.s { font-size: 14px; letter-spacing: .3em; }
.sp .body p { font-size: 16px; line-height: 1.95; color: var(--ink); background: rgba(10,13,10,.55); padding: 4px 6px; border-radius: 6px; }
.sp.tradition .when { color: #e2a867; }
.sp0 { width: min(60vw, 300px); display: flex; flex-direction: column; align-items: flex-start; }
.vt { writing-mode: vertical-rl; margin: 0; font: 600 clamp(38px, 11vw, 56px)/1.3 var(--serif); letter-spacing: .24em; text-shadow: 0 0 30px rgba(216,183,102,.35); }
.vr { margin: 18px 0 0; font-size: 12.5px; color: var(--muted); letter-spacing: .1em; }
.vh { margin: 28px 0 0; font-size: 12px; color: var(--ink-soft); letter-spacing: .12em; }
.vh span { color: var(--gold); display: inline-block; animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 0%,100% { transform: translateX(0); opacity: .5; } 50% { transform: translateX(7px); opacity: 1; } }
.gods { font: 600 clamp(24px, 7vw, 32px)/1.5 var(--serif); margin: 0 0 18px; color: var(--ink); }
.spE { padding-right: 10vw; }
.rv2 { opacity: 0; transform: translateX(28px); transition: opacity .8s ease, transform .9s cubic-bezier(.2,.7,.2,1); transition-delay: calc(var(--i, 0) * 120ms); }
.sp.in .rv2, .sp0 .rv2 { opacity: 1; transform: none; }
.spE.in .bignum b { }
body.emaki-open .sheet, body.emaki-open .photo { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .rv2 { opacity: 1 !important; transform: none !important; transition: none !important; } .vh span { animation: none; } }
@media (min-width: 880px) { .sp { width: min(46vw, 520px); } .sp0 { width: 200px; } }
.sp { margin-bottom: 30vh; scrollbar-width: none; }
.sp::-webkit-scrollbar { display: none; }
.sp0, .spE { margin-bottom: 22vh; }

.tree-body { overflow: auto; }
.tree-body svg { max-width: none; height: auto; }

.tree-btns { display: flex; gap: 6px; }
.tree-btns .ghost.on { border-color: var(--gold); color: var(--gold); }
.tree-focus { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 8px; font-size: 12.5px; color: var(--ink-soft); }
.tree-focus span { flex: 1 1 100%; }

/* 系譜図の動き：左の世代から順に、線が伸び、神様の枠が浮かぶ（動きを減らす設定では何もしない） */
svg.gene.anim .ed { stroke-dasharray: 1; stroke-dashoffset: 1; animation: geneLine .9s cubic-bezier(.3,.6,.2,1) forwards; animation-delay: calc(var(--c, 0) * 130ms + 220ms); }
svg.gene.anim .ed.sp { stroke-dasharray: 4 3; stroke-dashoffset: 0; opacity: 0; animation: geneFade .6s ease forwards; animation-delay: calc(var(--c, 0) * 130ms + 220ms); }
svg.gene.anim .nd { opacity: 0; animation: geneNode .7s cubic-bezier(.2,.7,.2,1) forwards; animation-delay: calc(var(--c, 0) * 130ms + var(--r, 0) * 18ms); transform-box: fill-box; transform-origin: center; }
svg.gene.anim .nd.me rect { animation: geneGlow 2.6s ease-in-out 1.2s infinite; }
@keyframes geneLine { to { stroke-dashoffset: 0; } }
@keyframes geneFade { to { opacity: 1; } }
@keyframes geneNode { from { opacity: 0; transform: translateY(8px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes geneGlow { 0%, 100% { filter: none; } 50% { filter: drop-shadow(0 0 6px rgba(216,183,102,.75)); } }
.acts .ghost.on { border-color: var(--gold); color: var(--gold); }

/* 昼夜：時刻の操作と、昼の読みやすさ */
.skybar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(150px + var(--safe-b)); max-width: calc(100vw - 20px); z-index: 6; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: rgba(16,19,15,0.82); border: 1px solid var(--line-strong); font-size: 12px; }
.skybar[hidden] { display: none; }
.skybar input[type=range] { width: 140px; accent-color: var(--gold); }
.skybar output { min-width: 5.2em; text-align: right; font-variant-numeric: tabular-nums; }
.acts .ghost.on { border-color: var(--gold); color: var(--gold); }
body.day .brand, body.day .hint, body.day .credit { text-shadow: 0 0 6px rgba(8,10,8,0.85), 0 0 2px rgba(8,10,8,0.9); }
body.day::before { content: ""; position: fixed; left: 0; right: 0; top: 0; height: 120px; z-index: 1; pointer-events: none; background: linear-gradient(rgba(8,10,8,0.5), transparent); }
#btnBgmNext[hidden] { display: none; }
.setgroup { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.setgroup[hidden] { display: none; }
.lbl.visited { color: #e8765a; }
.lbl.visited.sel { color: var(--gold); }
.visitbox { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 10px 0 4px; }
.visitbox small { color: var(--muted); font-size: 12px; }
.visitbox .vbtn { margin: 0; border-color: #e8765a; background: rgba(232,118,90,0.14); }
.visitbox .vdone { color: #e8765a; font-weight: 600; }
.visitbox .lnk { background: none; border: 0; color: var(--muted); text-decoration: underline; font: inherit; cursor: pointer; padding: 0 4px; min-height: 32px; }
.book { z-index: 10; }
.book-body { overflow: auto; padding-bottom: 24px; }
.bk-top { text-align: center; margin: 8px 0 4px; }
.bk-n { font-size: 40px; color: #e8765a; font-family: var(--serif); }
.bk-n small { font-size: 16px; color: var(--muted); margin-left: 4px; }
.bk-bar, .regs u { display: block; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.1); overflow: hidden; }
.bk-bar u, .regs u { text-decoration: none; }
.bk-bar u::before, .regs u::before { content: ''; display: block; height: 100%; width: var(--w); background: #e8765a; }
.bk-top p { color: var(--ink-soft); font-size: 13px; margin: 8px 0 0; }
.stpgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.stp { display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--muted); font: inherit; }
.stp i { font-style: normal; width: 48px; height: 48px; border-radius: 50%; border: 1px dashed var(--line); display: grid; place-items: center; font-size: 14px; opacity: 0.45; }
.stp small { font-size: 10px; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stp.on i { border: 2px solid #e8765a; color: #e8765a; opacity: 1; background: rgba(232,118,90,0.12); transform: rotate(-6deg); }
.stp.on { color: var(--ink); }
.regs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.regs li { display: grid; grid-template-columns: 5.5em 4em 1fr; align-items: center; gap: 8px; font-size: 13px; }
.regs b { text-align: right; font-weight: 500; color: var(--ink-soft); }
.bdgs { display: flex; flex-wrap: wrap; gap: 8px; }
.bdg { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.bdg.got { border-color: var(--gold); color: var(--gold); background: rgba(216,183,102,0.1); }
.vphoto { flex-basis: 100%; display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.vthumb { width: 72px; height: 96px; object-fit: cover; border-radius: 6px; border: 1px solid var(--gold); background: #000; }
.vphoto > span { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; }
.visitbox .pnote { flex-basis: 100%; }
.bk-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.bk-acts .btn { margin: 0; }
.finder { z-index: 11; }
.finder-in { width: 100%; box-sizing: border-box; margin: 10px 0 6px; padding: 12px 14px; font-size: 16px; color: var(--ink); background: rgba(255,255,255,0.06); border: 1px solid var(--gold); border-radius: 10px; font-family: inherit; }
.finder-in::placeholder { color: var(--muted); }
.finder-count { margin: 0 0 6px; color: var(--muted); font-size: 12px; min-height: 1.2em; }
.finder-list { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
.finder-list li button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 10px 4px; color: var(--ink); font: inherit; cursor: pointer; min-height: 48px; }
.finder-list li button:hover, .finder-list li button:focus-visible { background: rgba(216,183,102,0.08); outline: none; }
.finder-list li b { font-weight: 600; font-size: 16px; }
.finder-list li small { color: var(--muted); font-size: 12px; }
.finder-list li mark { background: rgba(216,183,102,0.28); color: var(--ink); border-radius: 2px; }
.finder-list li .vis { color: #e8765a; font-size: 12px; margin-left: 6px; }
.feedback { z-index: 12; }
.fb-form { overflow: auto; flex: 1; padding: 6px 2px 24px; max-width: 560px; width: 100%; margin: 0 auto; box-sizing: border-box; }
.fb-lead { color: var(--ink-soft); margin: 8px 0 12px; font-size: 14px; }
.fb-kinds { display: flex; gap: 8px; margin-bottom: 12px; }
.fbk { flex: 1; min-height: 44px; border-radius: 999px; border: 1px solid var(--line); background: none; color: var(--ink-soft); font: inherit; cursor: pointer; }
.fbk.on { border-color: var(--gold); color: var(--gold); background: rgba(216,183,102,0.12); }
.fb-l { display: block; margin: 10px 0 4px; font-size: 13px; color: var(--ink-soft); }
.fb-msg, .fb-contact { width: 100%; box-sizing: border-box; padding: 12px 14px; font-size: 16px; color: var(--ink); background: rgba(255,255,255,0.06); border: 1px solid var(--line); border-radius: 10px; font-family: inherit; }
.fb-msg:focus, .fb-contact:focus { outline: none; border-color: var(--gold); }
.fb-count { text-align: right; margin: 2px 2px 0; color: var(--muted); font-size: 12px; }
.fb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.fb-note { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 12px 0; }
.fb-send { width: 100%; justify-content: center; margin: 4px 0; }
.fb-send[disabled] { opacity: 0.5; cursor: default; }
.fb-status { min-height: 1.6em; font-size: 14px; margin: 10px 0; color: var(--ink-soft); }
.fb-status.ok { color: #9ccf8f; }
.fb-status.ng { color: #e8765a; }

/* 古事記と日本書紀（二つの書を比べる） */
.kiki-body { padding: 0 14px 28px; line-height: 1.75; font-size: 14px; }
.kiki-in { max-width: 760px; margin: 0 auto; }
.kiki-in h3 { font: 600 16px var(--serif); color: var(--gold); margin: 22px 0 8px; }
.kiki-in a { color: var(--gold); }
.kiki-tw { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.kiki-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.kiki-t th, .kiki-t td { border-bottom: 1px solid var(--line); padding: 8px 6px; vertical-align: top; text-align: left; }
.kiki-t thead th { font: 600 14px var(--serif); color: var(--ink); }
.kiki-t tbody th { color: var(--muted); font-weight: 600; white-space: nowrap; width: 5.5em; }
.kiki-tabs { flex-wrap: wrap; }
.kiki-tabs .fbk { flex: 1 1 auto; padding: 0 12px; font-size: 13px; min-height: 40px; }
.kiki-tabs .fbk b { margin-left: 4px; }
.kiki-list li button small { display: block; line-height: 1.5; }
@media (max-width: 600px) {
  .kiki-t thead { display: none; }
  .kiki-t, .kiki-t tbody, .kiki-t tr, .kiki-t th, .kiki-t td { display: block; width: auto; }
  .kiki-t tr { border: 1px solid var(--line); border-radius: 8px; margin: 10px 0; padding: 4px 10px 8px; background: rgba(24,36,27,0.5); }
  .kiki-t tbody th { border: 0; padding: 6px 0 2px; color: var(--gold); white-space: normal; }
  .kiki-t td { border: 0; padding: 4px 0; }
  .kiki-t td::before { content: attr(data-l); display: block; font: 600 12px var(--serif); color: var(--ink); }
}
