:root {
  --ink: #26241f;
  --muted: #6f695c;
  --line: #ddd5c3;
  --line-soft: #ece6d6;
  --paper: #fcfaf4;
  --panel: #ffffff;
  --accent: #b3402a;
  --accent-dark: #93321f;
  --navy: #2c4a67;
  --navy-dark: #203850;
  --gold: #a87b1f;
  --serif: "Hiragino Mincho ProN", "Hiragino Mincho Pro", "YuMincho", "Yu Mincho", "MS PMincho", serif;
  --sans: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "YuGothic", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.75;
}
a { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }
body { overflow-x: hidden; }
a:hover { color: var(--accent-dark); }
button, input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ヘッダー */
.site-header {
  border-top: 4px solid var(--accent);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  padding: 12px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 28px;
}
.brand { text-decoration: none; color: var(--ink); display: flex; align-items: baseline; gap: 12px; }
.brand strong { font-family: var(--serif); font-size: 23px; font-weight: 700; letter-spacing: .04em; }
.brand small { color: var(--muted); font-size: 12px; }
.site-header nav { margin-left: auto; display: flex; gap: 20px; flex-wrap: wrap; }
.site-header nav a { color: var(--ink); text-decoration: none; font-size: 14px; }
.site-header nav a:hover { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 4px; }

main { max-width: 1180px; margin: 0 auto; }

/* 導入 */
.intro { padding: 26px 20px 4px; }
.intro h1 { font-family: var(--serif); font-size: 29px; font-weight: 700; line-height: 1.45; margin: 0 0 10px; }
.intro p { margin: 0; color: #454138; font-size: 14.5px; max-width: 860px; }
.intro strong { color: var(--ink); }

/* セクション */
.section { padding: 26px 20px 8px; }
.section-title {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 700;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--ink);
}
.section-title::before {
  content: "";
  display: inline-block;
  width: 10px; height: 10px;
  background: var(--accent);
  margin-right: 11px;
}
.section-lead { color: var(--muted); font-size: 14px; margin: 0 0 16px; max-width: 880px; }
.small-note { color: var(--muted); font-size: 12.5px; line-height: 1.7; }

/* 地図で探す（全画面ステージ＋ボトムシート） */
.view[hidden] { display: none !important; }
header.site-header nav a.active { color: var(--accent); border-bottom: 2px solid var(--accent); }
#explorer {
  padding: 0;
  width: 100vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}
.map-stage {
  position: relative;
  height: calc(100dvh - 70px);
  min-height: 460px;
  overflow: hidden;
  background: #e9e3d3;
  --sheet-h: 118px;
}
#map { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-fallback {
  position: absolute; inset: 0; z-index: 3;
  overflow: auto; background: var(--paper);
  padding: 92px 18px 150px;
}
.map-fallback h3 { font-family: var(--serif); margin: 0 0 6px; }
.fallback-pins { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* 地図上の検索カード */
.map-search-card {
  position: absolute; top: 12px; left: 12px; z-index: 6;
  width: min(448px, calc(100% - 24px));
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 2px 10px rgba(38, 36, 31, .18);
  padding: 8px 10px;
}
.map-search-card:focus-within { border-color: var(--accent); }
.map-search-row { display: flex; align-items: center; gap: 8px; }
.search-icon { width: 20px; height: 20px; color: var(--muted); flex: none; }
.map-search-row input[type="search"] {
  flex: 1; min-width: 0; border: none; background: transparent;
  font-size: 15px; color: var(--ink); padding: 6px 2px;
}
.map-search-row input[type="search"]:focus { outline: none; }
.filter-toggle {
  flex: none; border: 1px solid #c6bda6; background: var(--paper); color: var(--ink);
  border-radius: 6px; padding: 6px 12px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.filter-toggle:hover { border-color: var(--accent); color: var(--accent-dark); }
.map-filters { display: grid; gap: 10px; padding: 10px 2px 4px; border-top: 1px dotted #c6bda6; margin-top: 8px; }
.map-filters[hidden] { display: none; }
.map-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.map-filters label.check-control { flex-direction: row; align-items: center; gap: 7px; color: var(--ink); font-size: 13.5px; }
.map-filters select {
  border: 1px solid #c6bda6; border-radius: 3px; background: var(--panel);
  padding: 7px 10px; font-size: 14px; color: var(--ink); width: 100%;
}

/* 現在地ボタンとメッセージ */
.locate-button {
  position: absolute; right: 14px; bottom: calc(var(--sheet-h) + 14px); z-index: 6;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--line); color: var(--accent);
  box-shadow: 0 2px 8px rgba(38, 36, 31, .22); cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
  transition: bottom .25s ease;
}
.map-stage.sheet-dragging .locate-button { transition: none; }
.locate-button svg { width: 24px; height: 24px; }
.locate-button:hover { color: var(--accent-dark); border-color: var(--accent); }
.user-marker {
  width: 18px; height: 18px; border-radius: 50%;
  background: #2c6fb3; border: 3px solid #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .4);
}
.map-message {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--sheet-h) + 14px); z-index: 7;
  background: rgba(38, 36, 31, .92); color: #fff; font-size: 13px;
  padding: 8px 14px; border-radius: 6px; margin: 0;
  max-width: min(92%, 480px); text-align: center;
}
.map-message[hidden] { display: none; }

/* ボトムシート */
.map-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  background: var(--panel); border-top: 1px solid var(--line);
  border-radius: 14px 14px 0 0; box-shadow: 0 -3px 14px rgba(38, 36, 31, .16);
  display: flex; flex-direction: column;
  transition: height .25s ease;
}
.map-sheet.dragging { transition: none; }
.sheet-top { padding: 6px 16px 9px; cursor: grab; touch-action: none; flex: none; }
.sheet-top:active { cursor: grabbing; }
.sheet-grip { display: block; width: 44px; height: 5px; border-radius: 3px; background: #c9c0aa; margin: 2px auto 8px; }
.sheet-header { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sheet-header h3 { font-family: var(--serif); font-size: 17px; margin: 0; }
.sheet-header #spot-result-count { color: var(--muted); font-size: 12.5px; }
.sheet-work-label { color: var(--accent-dark); font-size: 12.5px; font-weight: 700; }
.sheet-meta { margin: 2px 0 0; color: var(--muted); font-size: 11.5px; }
.sheet-body { overflow-y: auto; padding: 4px 14px 16px; -webkit-overflow-scrolling: touch; }
.spot-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.spot-card {
  display: grid; grid-template-columns: 32px 1fr; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 3px;
  padding: 12px 14px; cursor: pointer; text-align: left; width: 100%;
}
.spot-card:hover { border-color: #b9ae94; }
.spot-card.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.spot-number {
  width: 28px; height: 28px; border-radius: 2px; background: var(--accent); color: #fff;
  font-family: var(--serif); font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.spot-photo { width: 100%; height: 148px; object-fit: cover; border-radius: 2px; display: block; margin-bottom: 9px; }
.spot-card h4 { margin: 0 0 4px; font-size: 16px; line-height: 1.5; color: var(--ink); }
.spot-card p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 6px 0 10px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.spot-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 12px; }
.spot-meta .time-limited { color: #8a5a00; font-weight: 700; }
.card-actions { display: flex; gap: 8px; margin-top: 10px; }
.mini-button {
  border: 1px solid #b9ae94; background: var(--panel); color: var(--ink);
  border-radius: 3px; padding: 4px 11px; font-size: 12.5px; cursor: pointer;
}
.mini-button:hover { border-color: var(--accent); color: var(--accent-dark); }
.mini-button.add { background: var(--navy); border-color: var(--navy); color: #fff; }
.mini-button.add:hover { background: var(--navy-dark); color: #fff; }

.marker-pin {
  width: 34px; height: 34px; background: var(--accent);
  border: 2px solid #fff; border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
  cursor: pointer;
}
.marker-pin span { transform: rotate(45deg); color: #fff; font-family: var(--serif); font-weight: 700; font-size: 14px; }

/* ピンのポップアップ（どこの聖地かがその場で分かるように） */
.spot-popup { font-size: 13px; line-height: 1.55; }
.spot-popup .popup-photo { display: block; width: 100%; height: 120px; object-fit: cover; margin-bottom: 7px; }
.spot-popup p { margin: 0; }
.spot-popup .popup-work { color: var(--accent-dark); font-size: 11.5px; font-weight: 700; letter-spacing: .04em; }
.spot-popup .popup-name { display: block; font-family: var(--serif); font-size: 15.5px; margin: 1px 0 2px; }
.spot-popup .popup-relation { color: var(--ink); font-weight: 700; font-size: 12.5px; }
.spot-popup .popup-appearance { color: var(--ink); margin-top: 3px; }
.spot-popup .popup-access { color: var(--muted); font-size: 12px; margin-top: 5px; }
.spot-popup .popup-detail { margin-top: 8px; }
.marker-pin.in-plan { background: var(--navy); }

/* 作品一覧 */
.works-layout { display: grid; grid-template-columns: 1.15fr 1fr; gap: 26px; align-items: start; }
.featured-work { background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 18px 20px; }
.work-area { margin: 0 0 4px; color: var(--accent-dark); font-size: 12.5px; font-weight: 700; letter-spacing: .06em; }
.featured-work h3 { font-family: var(--serif); font-size: 22px; margin: 0 0 8px; }
.featured-work p { margin: 0 0 10px; font-size: 14px; }
.work-facts { margin: 14px 0 10px; }
.work-facts div { display: flex; gap: 16px; padding: 6px 0; border-top: 1px dotted #c6bda6; font-size: 13.5px; }
.work-facts dt { width: 92px; color: var(--muted); flex-shrink: 0; }
.work-facts dd { margin: 0; }
.queue-block h3 { font-family: var(--serif); font-size: 18px; margin: 2px 0 6px; }
.queue-list { list-style: none; margin: 0; padding: 0; }
.queue-list li { display: flex; align-items: baseline; gap: 11px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.queue-rank { font-family: var(--serif); font-weight: 700; color: var(--accent-dark); width: 20px; flex-shrink: 0; }
.queue-status { margin-left: auto; flex-shrink: 0; color: var(--muted); font-size: 11.5px; border: 1px solid var(--line); border-radius: 2px; padding: 0 7px; }

/* プラン */
.planner-grid { display: grid; grid-template-columns: 370px 1fr; gap: 22px; align-items: start; }
.plan-form { background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 16px 18px 18px; }
.plan-form h3 { font-family: var(--serif); font-size: 17px; margin: 0 0 10px; }
.plan-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.plan-form label.check-control { flex-direction: row; align-items: center; gap: 7px; color: var(--ink); font-size: 13.5px; }
.plan-form input, .plan-form select {
  border: 1px solid #c6bda6; border-radius: 3px; background: var(--panel);
  padding: 7px 10px; font-size: 14px; color: var(--ink); width: 100%;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plan-form details { border-top: 1px dotted #c6bda6; padding-top: 10px; margin-bottom: 14px; }
.plan-form summary { cursor: pointer; font-size: 13.5px; margin-bottom: 8px; }
.form-message { color: var(--accent-dark); font-size: 13px; margin: 8px 0 0; }

.button {
  display: inline-block; border-radius: 3px; padding: 9px 18px;
  font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none;
  border: 1px solid var(--navy); background: var(--panel); color: var(--navy);
}
.button.primary { background: var(--navy); color: #fff; }
.button.primary:hover { background: var(--navy-dark); color: #fff; }
.button.secondary:hover { border-color: var(--accent); color: var(--accent-dark); }
.button.wide { width: 100%; }
.start-custom { display: grid; gap: 9px; padding: 10px 0 2px; border-top: 1px dashed var(--line-soft); }
.start-custom .button { justify-self: start; }
.inline-input { display: flex; gap: 8px; }
.inline-input input { flex: 1; min-width: 0; }
.inline-input .button { flex: none; }

.summary-card { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--navy); border-radius: 3px; padding: 14px 18px 16px; position: sticky; top: 10px; z-index: 5; }
.summary-card h3 { font-family: var(--serif); font-size: 19px; margin: 0 0 10px; }
.summary-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; border-top: 1px dotted #c6bda6; border-bottom: 1px dotted #c6bda6; padding: 9px 0; }
.summary-stats span { display: block; color: var(--muted); font-size: 11.5px; }
.summary-stats strong { font-family: var(--serif); font-size: 18px; }
.warnings { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.warning { border-left: 3px solid var(--gold); background: #fdf6df; padding: 7px 11px; font-size: 13px; margin: 0; }
.warning.danger { border-left-color: var(--accent); background: #fbeeec; }
.plan-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.add-spot-row { margin: 18px 0 6px; }
.add-spot-row label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 6px; }
.add-spot-row div { display: flex; gap: 10px; }
.add-spot-row select { flex: 1; border: 1px solid #c6bda6; border-radius: 3px; padding: 7px 10px; background: var(--panel); font-size: 14px; }

.timeline { list-style: none; margin: 12px 0 0; padding: 0; }
.timeline-item { margin-bottom: 10px; }
.travel-row { color: var(--muted); font-size: 12.5px; margin: 2px 0 8px 18px; }
.plan-card { background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 13px 16px; }
.plan-card.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.plan-card-top { display: flex; justify-content: space-between; gap: 14px; align-items: start; }
.plan-time { font-family: var(--serif); font-size: 14px; color: var(--muted); white-space: nowrap; }
.timeline-number {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 2px; background: var(--navy); color: #fff;
  font-family: var(--serif); font-weight: 700; font-size: 13px; margin-right: 8px; vertical-align: 2px;
}
.plan-card h4 { display: inline; font-size: 16px; margin: 0; }
.plan-card p { margin: 6px 0; color: var(--muted); font-size: 13px; }
.plan-controls { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-top: 9px; }
.stay-control { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.stay-control input { width: 62px; border: 1px solid #c6bda6; border-radius: 3px; padding: 3px 7px; font-size: 13px; }
.empty-plan { border: 1px dashed #c6bda6; border-radius: 3px; padding: 18px; color: var(--muted); }
.empty-plan h3 { font-family: var(--serif); color: var(--ink); margin: 0 0 6px; font-size: 16px; }
.empty-plan p { margin: 0; font-size: 13.5px; }

/* このサイトについて */
.policy-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.policy-list article { border-top: 2px solid var(--ink); padding-top: 10px; }
.policy-list h3 { font-family: var(--serif); font-size: 16.5px; margin: 0 0 6px; }
.policy-list p { margin: 0; font-size: 13.5px; color: #454138; }

footer { max-width: 1180px; margin: 34px auto 0; padding: 18px 20px 36px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
footer p { margin: 0 0 4px; }
footer strong { color: var(--ink); font-family: var(--serif); font-size: 14px; }

/* 詳細ダイアログ */
.spot-dialog {
  width: min(680px, 94vw); max-height: 88vh; overflow: auto;
  border: 1px solid var(--line); border-radius: 4px; background: var(--panel);
  padding: 22px 24px; color: var(--ink);
}
.spot-dialog::backdrop { background: rgba(30, 28, 22, .45); }
.dialog-close {
  float: right; border: 1px solid #b9ae94; background: var(--panel); border-radius: 3px;
  width: 34px; height: 34px; font-size: 18px; cursor: pointer; line-height: 1;
}
.dialog-body h3 { font-family: var(--serif); font-size: 21px; margin: 0 24px 6px 0; line-height: 1.5; }
.dialog-photo { width: 100%; max-height: 340px; object-fit: cover; border-radius: 2px; display: block; margin: 6px 0 4px; }
.photo-credit { color: var(--muted); font-size: 11.5px; margin: 0 0 10px; }
.dialog-body h4 { font-family: var(--serif); font-size: 15.5px; margin: 18px 0 6px; border-bottom: 1px dotted #c6bda6; padding-bottom: 4px; }
.dialog-body p { font-size: 14px; margin: 0 0 8px; }
.dialog-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 22px; margin: 12px 0; }
.dialog-facts div { border-top: 1px dotted #c6bda6; padding-top: 5px; }
.dialog-facts dt { color: var(--muted); font-size: 11.5px; }
.dialog-facts dd { margin: 0; font-size: 13.5px; }
.caution { border-left: 3px solid var(--gold); background: #fdf6df; padding: 8px 12px; }
.source-list { margin: 0; padding-left: 18px; font-size: 13px; }
.source-list li { margin-bottom: 4px; }

.tabbar { display: none; }

@media (max-width: 920px) {
  .spot-list { grid-template-columns: 1fr; }
  .works-layout, .planner-grid, .policy-list { grid-template-columns: 1fr; }
  .intro h1 { font-size: 24px; }
  .site-header nav { margin-left: 0; }
  .summary-stats { grid-template-columns: repeat(2, 1fr); }
  .dialog-facts { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .site-header nav { display: none; }
  body { padding-bottom: 58px; }
  .map-stage { height: calc(100dvh - 70px - 58px); min-height: 400px; }
  .map-search-card { width: calc(100% - 64px); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: var(--panel); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 7px 0 6px; color: var(--muted); text-decoration: none;
    font-size: 11px; line-height: 1.3;
  }
  .tabbar a svg { width: 23px; height: 23px; }
  .tabbar a.active { color: var(--accent); }
}

@media print {
  body { background: #fff; }
  .site-header, .intro, #works, #explorer, .plan-form, .add-spot-row, .plan-actions, #data-policy, footer, .plan-controls, .dialog-close, .tabbar { display: none !important; }
  .section { padding: 0; }
  .planner-grid { display: block; }
  #planner[hidden] { display: block !important; }
  .summary-card, .plan-card { break-inside: avoid; }
  .timeline-item { break-inside: avoid; }
}
