:root {
  color-scheme: light;
  --bg: #f3eadf;
  --bg-soft: #fcf8f3;
  --panel: rgba(255, 250, 244, 0.88);
  --panel-strong: rgba(255, 252, 247, 0.96);
  --line: rgba(89, 62, 45, 0.14);
  --text: #2f241d;
  --muted: #6d5949;
  --visited: #bb5a2b;
  --visited-soft: rgba(187, 90, 43, 0.12);
  --planned: #2b7a78;
  --planned-soft: rgba(43, 122, 120, 0.12);
  --shadow: 0 20px 40px rgba(93, 63, 36, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Zen Kaku Gothic New", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(187, 90, 43, 0.14), transparent 24%),
    radial-gradient(circle at bottom right, rgba(43, 122, 120, 0.14), transparent 24%),
    linear-gradient(180deg, #f6ede2 0%, #ecdfd2 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  background-size: 100% 32px;
  opacity: 0.35;
}

.app-shell {
  width: min(1440px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 24px;
}

.topbar,
.panel,
.detail-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.topbar {
  border-radius: 28px;
  padding: 24px 26px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
}

.kicker,
.panel-kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Shippori Mincho", serif;
  font-weight: 700;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.08;
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1.25rem;
}

.subhead,
.detail-card p,
.detail-empty,
.meta-value,
.detail-note {
  color: var(--muted);
  line-height: 1.7;
}

.subhead {
  margin: 10px 0 0;
}

.summary-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.summary-chip {
  min-width: 116px;
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

.summary-chip span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.summary-chip strong {
  display: block;
  margin-top: 6px;
  font-size: 1.8rem;
  line-height: 1;
}

.summary-chip-visited strong {
  color: var(--visited);
}

.summary-chip-planned strong {
  color: var(--planned);
}

.workspace {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 16px;
  min-height: calc(100vh - 170px);
}

.panel {
  border-radius: 28px;
}

.sidebar {
  padding: 18px 14px 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-head {
  padding: 8px 10px 14px;
  border-bottom: 1px solid var(--line);
}

.legend {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.filter-switch {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  background: rgba(47, 36, 29, 0.05);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.filter-button {
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 10px 8px;
  cursor: pointer;
  transition:
    background 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

.filter-button:hover,
.filter-button:focus-visible {
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
  outline: none;
}

.filter-button.is-active {
  background: var(--panel-strong);
  color: var(--text);
  box-shadow: 0 6px 16px rgba(93, 63, 36, 0.08);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.legend-item::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.legend-item-visited {
  background: var(--visited-soft);
  color: var(--visited);
}

.legend-item-visited::before {
  background: var(--visited);
}

.legend-item-planned {
  background: var(--planned-soft);
  color: var(--planned);
}

.legend-item-planned::before {
  background: var(--planned);
}

.onsen-list {
  margin-top: 10px;
  overflow: auto;
  padding-right: 4px;
  display: grid;
  gap: 6px;
}

.onsen-list::-webkit-scrollbar {
  width: 10px;
}

.onsen-list::-webkit-scrollbar-thumb {
  background: rgba(109, 89, 73, 0.18);
  border-radius: 999px;
}

.onsen-item {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 16px;
  padding: 12px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    background 150ms ease,
    transform 150ms ease;
}

.onsen-item:hover,
.onsen-item:focus-visible,
.onsen-item.is-active {
  background: rgba(255, 255, 255, 0.6);
  transform: translateX(2px);
  outline: none;
}

.onsen-item-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  flex: 0 0 12px;
}

.onsen-item-dot.is-visited {
  background: var(--visited);
  box-shadow: 0 0 0 5px var(--visited-soft);
}

.onsen-item-dot.is-planned {
  background: var(--planned);
  box-shadow: 0 0 0 5px var(--planned-soft);
}

.onsen-item-name {
  font-size: 0.95rem;
  line-height: 1.45;
  font-weight: 500;
}

.map-stage {
  padding: 12px;
  display: grid;
  grid-template-rows: minmax(460px, 1fr) auto;
  gap: 12px;
  min-height: 0;
}

.map {
  min-height: 460px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #ddd8d0;
}

.detail-card {
  border-radius: 22px;
  padding: 18px 18px 16px;
  background: var(--panel-strong);
}

.detail-topline {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.toggle-status-button {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  color: white;
  background: linear-gradient(135deg, #a9532a 0%, #7d3618 100%);
  box-shadow: 0 10px 22px rgba(125, 54, 24, 0.22);
  transition:
    transform 150ms ease,
    box-shadow 150ms ease;
}

.toggle-status-button:hover,
.toggle-status-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(125, 54, 24, 0.28);
  outline: none;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.status-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.status-badge-visited {
  background: var(--visited-soft);
  color: var(--visited);
}

.status-badge-visited::before {
  background: var(--visited);
}

.status-badge-planned {
  background: var(--planned-soft);
  color: var(--planned);
}

.status-badge-planned::before {
  background: var(--planned);
}

.detail-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.detail-meta {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid var(--line);
}

.meta-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}

.meta-value {
  margin: 0;
  color: var(--text);
  font-size: 0.94rem;
}

.tag-row {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(47, 36, 29, 0.06);
  font-size: 0.82rem;
  color: var(--muted);
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #fff9f3;
  color: var(--text);
}

.map-pin {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.map-pin-visited {
  background: var(--visited);
}

.map-pin-planned {
  background: var(--planned);
}

@media (max-width: 980px) {
  .topbar,
  .workspace {
    grid-template-columns: 1fr;
    display: grid;
  }

  .topbar {
    align-items: start;
  }

  .summary-row {
    justify-content: start;
  }

  .workspace {
    min-height: auto;
  }

  .sidebar {
    max-height: 320px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 14px, 1440px);
    padding-top: 10px;
  }

  .topbar {
    padding: 18px;
    border-radius: 22px;
  }

  .panel {
    border-radius: 22px;
  }

  .map-stage {
    padding: 10px;
    grid-template-rows: minmax(360px, 1fr) auto;
  }

  .map {
    min-height: 360px;
  }

  .summary-chip {
    min-width: 0;
    flex: 1 1 0;
  }
}
