:root {
  --paper: #fbfaf7;
  --paper-2: #f1f0eb;
  --ink: #202124;
  --muted: #6e706e;
  --soft: #92948f;
  --line: #d9d7d0;
  --line-dark: #b7b5ae;
  --panel: rgba(253, 252, 249, 0.96);
  --accent: #c33a31;
  --accent-dark: #9f2d27;
  --accent-soft: #f4e4df;
  --shadow: 0 18px 50px rgba(61, 56, 45, 0.16), 0 2px 7px rgba(61, 56, 45, 0.08);
  --shadow-soft: 0 10px 28px rgba(61, 56, 45, 0.12);
  --serif: "Noto Serif SC", "Songti SC", Georgia, serif;
  --sans: Inter, "Noto Sans SC", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --z-map: 0;
  --z-panel: 5;
  --z-reader: 6;
  --z-lightbox: 20;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper-2);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.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;
}
.skip-link {
  position: fixed;
  top: 8px;
  left: 50%;
  z-index: 30;
  padding: 9px 14px;
  color: #fff;
  background: var(--ink);
  transform: translate(-50%, -150%);
  transition: transform 180ms ease;
}
.skip-link:focus { transform: translate(-50%, 0); }

#map { position: fixed; inset: 0; z-index: var(--z-map); background: #dfe7e5; }
.map-veil {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 54% 44%, transparent 0 34%, rgba(249, 247, 240, 0.12) 74%),
    linear-gradient(90deg, rgba(250, 248, 241, 0.14), transparent 28%);
  mix-blend-mode: multiply;
}
.maplibregl-map,
.mapboxgl-map { font-family: var(--sans); }
.maplibregl-ctrl-bottom-right,
.mapboxgl-ctrl-bottom-right { right: 16px; bottom: 16px; }
.maplibregl-ctrl-group,
.mapboxgl-ctrl-group {
  overflow: hidden;
  border: 1px solid rgba(42, 43, 43, 0.16);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}
.maplibregl-ctrl-group button,
.mapboxgl-ctrl-group button { width: 34px; height: 34px; }
.maplibregl-ctrl-attrib,
.mapboxgl-ctrl-attrib { opacity: 0.68; font-size: 10px; }
.map-settings {
  position: fixed;
  right: 26px;
  bottom: 124px;
  z-index: 4;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 8px;
}
.map-settings-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-left: auto;
  padding: 0;
  border: 1px solid rgba(45, 45, 42, 0.18);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(253, 252, 249, 0.94);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
  cursor: pointer;
}
.map-settings-toggle:hover,
.map-settings.is-open .map-settings-toggle { color: #fff; background: var(--ink); }
.map-settings-toggle svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.map-settings-panel {
  display: grid;
  gap: 7px;
  width: max-content;
  max-width: min(252px, calc(100vw - 44px));
  margin: 0;
  padding: 8px;
  border: 1px solid rgba(45, 45, 42, 0.18);
  border-radius: 9px;
  background: rgba(253, 252, 249, 0.96);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
}
.map-language,
.map-style-switcher {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 5px;
  border: 1px solid rgba(45, 45, 42, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.56);
}
.map-language span,
.map-style-switcher span { padding: 0 5px; color: var(--muted); font-size: 10px; }
.map-language button,
.map-style-switcher button {
  min-width: 30px;
  height: 27px;
  padding: 0 7px;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  cursor: pointer;
}
.map-style-switcher button { min-width: 42px; }
.map-language button:hover,
.map-style-switcher button:hover { color: var(--ink); background: var(--paper-2); }
.map-language button.is-on,
.map-style-switcher button.is-on { color: #fff; background: var(--ink); }

.panel {
  position: fixed;
  top: 22px;
  left: 22px;
  bottom: 22px;
  z-index: var(--z-panel);
  width: min(360px, calc(100vw - 44px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid rgba(45, 45, 42, 0.18);
  border-radius: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px) saturate(0.8);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px 15px 15px;
}
.mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
}
.mark span {
  position: absolute;
  right: -3px;
  bottom: -2px;
  display: grid;
  place-items: center;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font: 700 8px/1 var(--sans);
}
.brand-text { min-width: 0; flex: 1; }
.brand-text strong {
  display: block;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-text span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.brand-action {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease;
}
.brand-action:hover { color: var(--ink); background: var(--paper-2); }
.brand-action svg, .panel-foot svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.search {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.78);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.search:focus-within { border-color: var(--line-dark); box-shadow: 0 0 0 3px rgba(195, 58, 49, 0.09); }
.search svg {
  width: 16px;
  margin-left: 12px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
}
.search input {
  width: 100%;
  min-width: 0;
  height: 39px;
  padding: 0 42px 0 9px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 12.5px;
}
.search input::placeholder { color: #8d8f8c; }
.search kbd {
  position: absolute;
  right: 9px;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--soft);
  background: var(--paper);
  font: 10px/1 var(--sans);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  padding: 12px 14px 14px;
  border-bottom: 1px solid var(--line);
}
.chip {
  height: 34px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #555754;
  background: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  cursor: pointer;
  transition: transform 160ms ease, color 160ms ease, border-color 160ms ease, background 160ms ease;
}
.chip:hover { border-color: var(--line-dark); color: var(--ink); transform: translateY(-1px); }
.chip:active { transform: translateY(0) scale(0.98); }
.chip.is-on { border-color: var(--ink); color: #fff; background: var(--ink); }

.story-list { flex: 1; overflow: auto; padding: 3px 14px 20px; scrollbar-width: thin; scrollbar-color: #c9c7c0 transparent; }
.journey-group { padding: 15px 0 8px; }
.journey-group + .journey-group { border-top: 1px solid var(--line); }
.journey-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px 10px;
}
.journey-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.journey-summary { display: none; }
.story-card {
  position: relative;
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 78px;
  margin: 0 0 5px;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
.story-card:hover { background: #fff; transform: translateX(2px); }
.story-card:active { transform: translateX(2px) scale(0.992); }
.story-card.is-active {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 5px 18px rgba(79, 61, 49, 0.08);
}
.story-thumb {
  position: relative;
  width: 70px;
  height: 62px;
  overflow: hidden;
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(195, 58, 49, 0.18), transparent 55%),
    #dfe2de;
}
.story-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; filter: saturate(0.82) contrast(1.03); }
.story-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(32, 33, 36, 0.08);
  border-radius: inherit;
  pointer-events: none;
}
.story-main { min-width: 0; }
.story-main strong {
  display: block;
  overflow: hidden;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.story-meta { display: flex !important; align-items: center; gap: 5px; margin-top: 6px !important; color: var(--muted); font-size: 10.5px !important; }
.story-meta::before { content: ""; width: 4px; height: 4px; border: 1px solid currentColor; border-radius: 50%; }
.story-select {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border: 1px solid var(--line-dark);
  border-radius: 50%;
}
.story-select::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: transparent; }
.story-card.is-active .story-select { border-color: var(--accent); }
.story-card.is-active .story-select::after { background: var(--accent); }
.type-tag {
  position: absolute;
  top: 9px;
  left: 9px;
  padding: 2px 5px;
  border-radius: 3px;
  color: #fff;
  background: rgba(32, 33, 36, 0.76);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.03em;
  backdrop-filter: blur(4px);
}
.list-empty { margin: 16px 2px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: rgba(246, 245, 241, 0.68);
  font-size: 10.5px;
}

.reader {
  position: fixed;
  top: 22px;
  right: 22px;
  bottom: 22px;
  z-index: var(--z-reader);
  width: min(520px, calc(100vw - 426px));
  overflow: auto;
  background: var(--paper);
  border: 1px solid rgba(45, 45, 42, 0.18);
  border-radius: 12px;
  box-shadow: var(--shadow);
  animation: reader-in 320ms cubic-bezier(0.22, 1, 0.36, 1);
  scrollbar-width: thin;
  scrollbar-color: #c9c7c0 transparent;
}
.reader:focus { outline: none; }
@keyframes reader-in {
  from { opacity: 0; transform: translateX(18px) scale(0.99); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
.reader-toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  padding: 14px;
  background: linear-gradient(var(--paper) 68%, rgba(251, 250, 247, 0));
}
.reader-back, .reader-close {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}
.reader-actions { display: flex; gap: 7px; }
.reader-back:hover, .reader-close:hover { border-color: var(--ink); background: #fff; transform: translateY(-1px); }
.reader-toolbar svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.reader-inner { padding: 0 24px 34px; }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: 0.07em; font-variant-numeric: tabular-nums; }
.eyebrow::after { content: " · 旅行"; color: var(--ink); }
.eyebrow.pilgrimage::after { content: " · 巡礼"; }
.eyebrow.live::after { content: " · Live"; }
.reader h1 {
  margin: 14px 0 9px;
  font-family: var(--serif);
  font-size: clamp(32px, 3.2vw, 45px);
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.045em;
  text-wrap: balance;
}
.reader-meta { color: var(--muted); font-size: 11px; }
.reader-summary { max-width: 43em; margin: 15px 0 0; color: #4d4f4c; font-size: 13px; line-height: 1.8; text-wrap: pretty; }
.reader-body { margin-top: 13px; }
.reader-body p { margin: 0 0 12px; color: #474946; font-family: var(--serif); font-size: 13px; line-height: 1.95; }
.lead-media {
  display: block;
  width: min(100%, calc(var(--ratio, 1.777) * 560px));
  margin: 18px auto 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: var(--paper-2);
  cursor: zoom-in;
}
.lead-media img {
  display: block;
  width: 100%;
  aspect-ratio: var(--ratio, 16 / 9);
  object-fit: cover;
  filter: saturate(0.9) contrast(1.02);
  transition: transform 450ms cubic-bezier(0.22, 1, 0.36, 1), filter 250ms ease;
}
.lead-media:hover img { transform: scale(1.018); filter: saturate(1) contrast(1.02); }
.section-label {
  margin: 25px 0 11px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.gallery { display: grid; gap: 8px; }
.gallery-row { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.gallery-row figure { min-width: 0; flex-basis: 0; margin: 0; }
.gallery-row.single figure { flex-basis: min(100%, calc(var(--ratio) * 380px)); flex-grow: 0 !important; }
.gallery button {
  display: block;
  width: 100%;
  aspect-ratio: var(--ratio, 3 / 2);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 7px;
  background: var(--paper-2);
  cursor: zoom-in;
}
.gallery img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9);
  transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1), filter 250ms ease;
}
.gallery button:hover img { transform: scale(1.025); filter: saturate(1); }
.gallery figcaption { margin-top: 5px; color: var(--muted); font-size: 9.5px; }

.match { margin-bottom: 12px; }
.match-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.match-pair button { position: relative; padding: 0; overflow: hidden; border: 0; border-radius: 7px; background: var(--paper-2); cursor: zoom-in; }
.match-pair img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform 350ms ease; }
.match-pair button:hover img { transform: scale(1.025); }
.match-pair .badge {
  position: absolute;
  left: 7px;
  top: 7px;
  z-index: 1;
  padding: 3px 6px;
  border-radius: 3px;
  color: #fff;
  background: rgba(32, 33, 36, 0.72);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.match h3 { margin: 9px 0 3px; font-family: var(--serif); font-size: 13px; }
.match-info, .visit-source { color: var(--muted); font-size: 10px; line-height: 1.5; }
.visit-source { margin-top: 5px; }
.match-note { margin: 6px 0 0; color: #4c4e4b; font-size: 11px; line-height: 1.65; }
.anime-archive-link {
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--paper);
  font-size: 11px;
  cursor: pointer;
}
.anime-archive-link:hover { border-color: var(--accent); color: var(--accent-dark); }
.anime-place-group > h2 { margin: 24px 0 10px; font-size: 13px; }
.reader-error { padding: 40px; color: var(--muted); }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-lightbox);
  display: grid;
  place-items: center;
  padding: 32px;
  background: rgba(25, 26, 27, 0.9);
}
.lightbox figure { margin: 0; max-width: 92vw; max-height: 92vh; text-align: center; }
.lightbox img { max-width: 92vw; max-height: 84vh; border-radius: 6px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5); }
.lightbox figcaption { margin-top: 12px; color: #e8e6df; font-size: 12px; }
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  font-size: 22px;
  cursor: pointer;
}

.map-preview {
  width: min(260px, calc(100vw - 36px));
  overflow: hidden;
  border: 1px solid rgba(42, 43, 43, 0.16);
  border-radius: 8px;
  background: rgba(253, 252, 249, 0.97);
  box-shadow: 0 14px 34px rgba(33, 35, 34, 0.2);
  backdrop-filter: blur(12px);
}
.map-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px 7px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}
.map-preview-head button {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.map-preview-head button:hover { color: var(--ink); background: var(--paper-2); }
.map-preview-list {
  display: grid;
  gap: 1px;
  max-height: 292px;
  overflow: auto;
  background: var(--line);
}
.map-preview-item {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 9px;
  border: 0;
  color: var(--ink);
  background: var(--paper);
  text-align: left;
  cursor: pointer;
}
.map-preview-item:hover { background: #f4f1e9; }
.map-preview-thumb {
  display: block;
  width: 76px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 6px;
  background: var(--paper-2);
}
.map-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.map-preview-copy {
  min-width: 0;
  align-self: center;
}
.map-preview-copy strong {
  display: block;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.map-preview-copy span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

@media (max-width: 980px) {
  .panel { top: 14px; left: 14px; bottom: auto; max-height: 47dvh; }
  .reader {
    top: auto;
    left: 14px;
    right: 14px;
    bottom: 14px;
    width: auto;
    max-height: 67dvh;
  }
}
@media (max-width: 600px) {
  .map-settings { right: 18px; bottom: 136px; }
  .map-settings-panel { max-width: calc(100vw - 16px); transform-origin: bottom right; }
  .map-style-switcher { flex-wrap: wrap; justify-content: flex-end; }
  .map-style-switcher span { width: 100%; }
  .map-style-switcher button { min-width: 34px; padding-inline: 6px; }
  .panel { right: 14px; width: auto; max-height: 43dvh; }
  .brand { padding-top: 13px; padding-bottom: 11px; }
  .search { margin-inline: 10px; }
  .filters { padding: 9px 10px 11px; }
  .story-list { padding-inline: 10px; }
  .story-card { grid-template-columns: 58px minmax(0, 1fr) 18px; min-height: 68px; }
  .story-thumb { width: 58px; height: 52px; }
  .reader-inner { padding-inline: 18px; }
  .reader h1 { font-size: 31px; }
  .gallery-row { display: grid; grid-template-columns: 1fr; }
  .gallery-row.single figure,
  .gallery-row figure { width: 100%; flex-basis: auto; }
  .maplibregl-ctrl-bottom-right,
  .mapboxgl-ctrl-bottom-right { right: 8px; bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
