:root {
  --bg: #f3f0e8;
  --panel: #fffdf8;
  --panel-soft: #f7f2e8;
  --ink: #18211d;
  --muted: #657168;
  --line: #ded7c8;
  --green: #176048;
  --green-dark: #0e3f31;
  --river: #4c8fa1;
  --road: #f7f4ea;
  --orange: #c65b32;
  --purple: #7256a5;
  --blue: #2f6678;
  --shadow: 0 18px 42px rgba(48, 39, 26, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html,
body {
  height: 100%;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

.app-shell {
  height: 100vh;
  min-height: 720px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(255, 253, 248, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.map-link,
.action,
.panel-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 10px;
  font-weight: 800;
  text-decoration: none;
}

.map-link {
  background: var(--green);
  color: #fff;
}

main {
  width: 100%;
  height: calc(100vh - 65px);
  margin: 0 auto;
  padding: 0;
}

.travel-map {
  display: grid;
  grid-template-columns: minmax(430px, 33vw) minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--panel);
}

.map-sidebar {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
  height: 100%;
  max-height: none;
  overflow: auto;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.sidebar-header {
  display: grid;
  gap: 8px;
}

.eyebrow {
  margin: 0;
  color: var(--orange);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 10px;
  font-size: 18px;
  line-height: 1.35;
}

h3 {
  margin-bottom: 6px;
  font-size: 16px;
  line-height: 1.35;
}

.sidebar-header p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.search-panel,
.filter-panel,
.select-label {
  display: grid;
  gap: 10px;
}

.search-label,
.filter-label,
.select-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cfc6b6;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

input {
  padding: 10px 13px;
}

select {
  padding: 10px 36px 10px 12px;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(198, 91, 50, 0.3);
  outline-offset: 2px;
}

.clear-button {
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--green-dark);
  font-weight: 900;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stats div {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.stats strong,
.stats span {
  display: block;
}

.stats strong {
  font-size: 24px;
  line-height: 1;
}

.stats span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.segmented,
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented button,
.chips button {
  min-height: 36px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.segmented button span,
.chips button span {
  margin-left: 5px;
  color: var(--muted);
  font-size: 12px;
}

.segmented button.active,
.chips button.active {
  border-color: var(--green-dark);
  background: var(--green);
  color: #fff;
}

.segmented button.active span,
.chips button.active span {
  color: rgba(255, 255, 255, 0.78);
}

.results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}

.results-head h2,
.results-head p {
  margin-bottom: 0;
}

#count {
  color: var(--muted);
  font-weight: 900;
  white-space: nowrap;
}

.spotlight {
  display: grid;
  gap: 10px;
}

.spotlight-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.spotlight-title strong {
  font-size: 15px;
}

.spotlight-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.spotlight-grid {
  display: grid;
  grid-auto-columns: minmax(160px, 46%);
  grid-auto-flow: column;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.spotlight-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-decoration: none;
}

.spotlight-card img {
  display: block;
  width: 100%;
  height: 110px;
  object-fit: cover;
  background: #d8ddd3;
}

.spotlight-card div {
  display: grid;
  gap: 3px;
  padding: 9px;
}

.spotlight-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.spotlight-card strong {
  overflow: hidden;
  font-size: 13px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spot-list {
  display: grid;
  gap: 10px;
}

.spot-card {
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.spot-media {
  min-height: 100%;
  background: #d8ddd3;
}

.spot-media img,
.media-placeholder {
  width: 100%;
  height: 100%;
  min-height: 168px;
}

.spot-media img {
  display: block;
  object-fit: cover;
}

.media-placeholder {
  display: grid;
  place-items: center;
  padding: 10px;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.spot-body {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px;
}

.meta-row,
.actions,
.detail-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.map-number-badge,
.tag,
.subtag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.map-number-badge {
  border: 0;
  background: var(--orange);
  color: #fff;
}

.map-number-badge:hover,
.map-number-badge:focus-visible {
  background: #a84623;
}

.tag {
  background: var(--green);
  color: #fff;
}

.subtag {
  max-width: 100%;
  overflow: hidden;
  background: #e9efe5;
  color: var(--green-dark);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.description {
  display: -webkit-box;
  overflow: hidden;
  margin-bottom: 0;
  color: #3c463f;
  font-size: 13px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.element-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.element-tags span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1eadc;
  color: #574a35;
  font-size: 11px;
  font-weight: 900;
}

.facts {
  display: none;
}

.action {
  min-height: 34px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--green-dark);
  font-size: 13px;
}

.action.primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.more {
  display: none;
}

.empty {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.map-stage {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  height: 100%;
  min-height: 0;
  background: #dfe8db;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(30, 65, 49, 0.14);
  background: rgba(255, 253, 248, 0.82);
  backdrop-filter: blur(14px);
}

.map-toolbar strong,
.map-toolbar span {
  display: block;
}

.map-toolbar strong {
  font-size: 15px;
}

.map-toolbar > div:first-child span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.map-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--green);
}

.legend-eat {
  background: var(--orange) !important;
}

.legend-shop {
  background: var(--purple) !important;
}

.legend-stay {
  background: var(--blue) !important;
}

.map-canvas {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.32) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.32) 1px, transparent 1px),
    #e7eddf;
  background-size: 58px 58px;
}

.real-map {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #dfe8db;
}

.leaflet-container {
  width: 100%;
  height: 100%;
  font-family: inherit;
}

.leaflet-control-zoom a {
  color: var(--green-dark);
  font-weight: 900;
}

.leaflet-control-attribution {
  margin-bottom: 124px !important;
  border-radius: 8px 0 0 0;
  font-size: 10px;
}

.leaflet-number-marker {
  width: auto !important;
  height: 38px !important;
  border: 0;
  background: transparent;
}

.marker-pin-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 174px;
}

.leaflet-number-marker .marker-number {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(24, 33, 29, 0.3);
}

.marker-title {
  display: block;
  max-width: 128px;
  overflow: hidden;
  padding: 7px 10px;
  border: 1px solid rgba(23, 96, 72, 0.2);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.94);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 10px 22px rgba(24, 33, 29, 0.18);
  backdrop-filter: blur(10px);
}

.leaflet-number-marker:hover .marker-title,
.leaflet-number-marker:focus-within .marker-title {
  max-width: 180px;
  background: #fff;
}

.leaflet-number-marker.is-food .marker-number {
  background: var(--orange);
}

.leaflet-number-marker.is-shop .marker-number {
  background: var(--purple);
}

.leaflet-number-marker.is-stay .marker-number {
  background: var(--blue);
}

.spot-cluster-marker {
  display: grid;
  width: 50px !important;
  height: 50px !important;
  place-items: center;
  border-radius: 50%;
  background: rgba(198, 91, 50, 0.18);
}

.spot-cluster-marker span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(24, 33, 29, 0.22);
}

.map-popup {
  display: grid;
  width: 230px;
  gap: 8px;
  color: var(--ink);
}

.popup-photo {
  display: block;
  width: 100%;
  height: 128px;
  border-radius: 8px;
  object-fit: cover;
  background: #d8ddd3;
}

.popup-area {
  display: block;
  margin-bottom: 3px;
  color: var(--orange);
  font-size: 11px;
  font-weight: 900;
}

.map-popup strong {
  display: block;
  line-height: 1.35;
}

.map-popup p {
  display: -webkit-box;
  overflow: hidden;
  margin-bottom: 0;
  color: #3c463f;
  font-size: 12px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.popup-tags,
.popup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.popup-tags span {
  padding: 4px 7px;
  border-radius: 999px;
  background: #f1eadc;
  color: #574a35;
  font-size: 10px;
  font-weight: 900;
}

.popup-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.popup-actions a + a {
  background: var(--panel-soft);
  color: var(--green-dark);
}

.map-grid {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 22% 24%, rgba(23, 96, 72, 0.16), transparent 25%),
    radial-gradient(circle at 78% 76%, rgba(23, 96, 72, 0.12), transparent 29%),
    radial-gradient(circle at 45% 62%, rgba(198, 91, 50, 0.08), transparent 24%);
}

.map-terrain {
  position: absolute;
  border-radius: 999px;
  background: rgba(23, 96, 72, 0.12);
  transform: rotate(-19deg);
}

.terrain-north {
  left: -9%;
  top: -7%;
  width: 63%;
  height: 34%;
}

.terrain-south {
  right: -19%;
  bottom: -15%;
  width: 76%;
  height: 42%;
}

.map-river {
  position: absolute;
  left: -8%;
  top: 50%;
  width: 116%;
  height: 42px;
  border-radius: 999px;
  background: rgba(76, 143, 161, 0.62);
  transform: rotate(-11deg);
  box-shadow: 0 0 0 12px rgba(76, 143, 161, 0.13);
}

.map-river span {
  position: absolute;
  left: 18%;
  top: 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.map-road {
  position: absolute;
  border-radius: 999px;
  background: var(--road);
  box-shadow: 0 0 0 6px rgba(23, 96, 72, 0.66);
}

.road-main {
  left: 51%;
  top: -9%;
  width: 20px;
  height: 118%;
  transform: rotate(17deg);
}

.road-main span {
  position: absolute;
  left: -16px;
  top: 43%;
  display: grid;
  width: 52px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  transform: rotate(-17deg);
}

.road-branch {
  left: 9%;
  top: 34%;
  width: 82%;
  height: 14px;
  transform: rotate(12deg);
}

.area-label {
  position: absolute;
  z-index: 2;
  padding: 7px 10px;
  border: 1px solid rgba(23, 96, 72, 0.18);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.82);
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(48, 39, 26, 0.08);
}

.area-kamiyama {
  left: 54%;
  top: 44%;
}

.area-ono {
  left: 18%;
  top: 51%;
}

.area-orono {
  left: 33%;
  top: 20%;
}

.area-shimobun {
  left: 68%;
  top: 74%;
}

.area-kamibun {
  left: 78%;
  top: 42%;
}

.map-markers {
  position: absolute;
  inset: 0;
  z-index: 4;
}

.map-building {
  position: absolute;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  box-shadow: 0 10px 22px rgba(48, 39, 26, 0.22);
  transform: translate(-21px, -21px);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.map-building:hover,
.map-building:focus-visible {
  z-index: 8;
  transform: translate(-21px, -27px);
  box-shadow: 0 16px 30px rgba(48, 39, 26, 0.28);
}

.building-glyph {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  transform: none;
}

.building-glyph::before {
  content: none;
}

.building-label {
  display: none;
}

.map-building[data-category="食事"] {
  background: var(--orange);
}

.map-building[data-category="お土産"] {
  background: var(--purple);
}

.map-building[data-category="宿泊"] {
  background: var(--blue);
}

.map-index-panel {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: 18px;
  z-index: 9;
  width: auto;
  padding: 12px;
  border: 1px solid rgba(23, 96, 72, 0.16);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.map-index-panel h2 {
  margin-bottom: 10px;
  font-size: 16px;
}

.map-index {
  display: grid;
  grid-auto-columns: minmax(190px, 240px);
  grid-auto-flow: column;
  gap: 8px;
  overflow-x: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.map-index button {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  gap: 8px;
  padding: 7px;
  border: 1px solid rgba(23, 96, 72, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  text-align: left;
}

.map-index button:hover,
.map-index button:focus-visible {
  background: #fff;
  box-shadow: 0 8px 18px rgba(48, 39, 26, 0.12);
}

.map-index button span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.map-index button strong {
  overflow: hidden;
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-index button small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.map-index-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 980px) {
  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

  .map-link {
    width: 100%;
  }

  main {
    width: 100%;
    height: auto;
    padding-top: 0;
  }

  .travel-map {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  .map-sidebar {
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .map-stage {
    height: 68vh;
    min-height: 560px;
    order: -1;
  }

  .map-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .map-legend {
    justify-content: flex-start;
  }

  .map-index-panel {
    left: 14px;
    right: 14px;
    top: auto;
    bottom: 14px;
    width: auto;
    max-height: 170px;
  }

  .map-index {
    grid-auto-columns: minmax(180px, 230px);
  }
}

@media (max-width: 560px) {
  .map-sidebar {
    padding: 18px;
  }

  h1 {
    font-size: 28px;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .search-row {
    grid-template-columns: 1fr;
  }

  .map-stage {
    min-height: 570px;
  }

  .leaflet-control-attribution {
    margin-bottom: 114px !important;
    max-width: 230px;
  }

  .map-index {
    grid-template-columns: 1fr;
  }

  .map-index button {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .map-index button small {
    display: none;
  }

  .area-label {
    padding: 5px 8px;
    font-size: 11px;
  }

  .spot-card {
    grid-template-columns: 118px minmax(0, 1fr);
  }
}
