:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1c2128;
  --ink-soft: #5b6571;
  --ink-faint: #98a1ac;
  --line: #e6e9ee;
  --accent: #2f6fed;
  --shadow: 0 6px 24px rgba(20, 30, 50, 0.08);
  --sidebar-w: 380px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: "Noto Sans JP", "Inter", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 1000;
}

.sidebar__header {
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.sidebar__title {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.sidebar__subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.controls {
  padding: 18px 24px 6px;
}

.search {
  position: relative;
  margin-bottom: 16px;
}

.search__icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--ink-faint);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search__input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fafbfc;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
  background: #fff;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s;
}

.filter__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  opacity: 0.35;
  transition: opacity 0.15s;
}

.filter.is-active {
  color: var(--ink);
  border-color: #cdd3db;
  background: #f7f9fc;
}

.filter.is-active .filter__dot {
  opacity: 1;
}

.list-meta {
  padding: 14px 24px 8px;
  font-size: 12px;
  color: var(--ink-faint);
}

/* ---------- Museum list ---------- */
.museum-list {
  list-style: none;
  margin: 0;
  padding: 0 12px 12px;
  overflow-y: auto;
  flex: 1;
}

.museum-item {
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.12s;
}

.museum-item:hover {
  background: #f3f6fb;
}

.museum-item__bar {
  width: 4px;
  border-radius: 4px;
  flex-shrink: 0;
}

.museum-item__body {
  flex: 1;
  min-width: 0;
}

.museum-item__name {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
}

.museum-item__en {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.museum-item__addr {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
}

.museum-item__cat {
  font-size: 11px;
  font-weight: 700;
  align-self: center;
  flex-shrink: 0;
}

.sidebar__footer {
  padding: 14px 24px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
}

/* ---------- Map ---------- */
.map-wrap {
  position: relative;
  flex: 1;
}

#map {
  position: absolute;
  inset: 0;
}

.museum-marker__dot {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.12s;
}

.museum-marker:hover .museum-marker__dot {
  transform: scale(1.25);
}

/* ---------- Popup ---------- */
.popup {
  font-family: inherit;
  width: 250px;
}

.popup__photo {
  margin: -14px -16px 12px;
  height: 150px;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
  background: #eef1f5;
}

.popup__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.popup__tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.popup__title {
  margin: 8px 0 2px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.popup__en {
  margin: 0;
  font-size: 12px;
  color: var(--ink-faint);
}

.popup__addr {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.popup__desc {
  margin: 8px 0 10px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
}

.popup__links {
  display: flex;
  align-items: center;
  gap: 14px;
}

.popup__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.popup__link:hover {
  text-decoration: underline;
}

.popup__link--maps {
  color: #1a73e8;
}

.popup__link--maps svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.leaflet-popup-content {
  margin: 14px 16px;
}

.leaflet-popup-content-wrapper {
  border-radius: 12px;
}

/* ---------- Locate (current position) ---------- */
.locate-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 9px;
  background: #fff;
  box-shadow: var(--shadow);
  color: #1a73e8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.locate-btn:hover {
  background: #f5f8ff;
}

.locate-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.locate-btn.is-loading {
  pointer-events: none;
  opacity: 0.6;
}

.locate-btn.is-loading svg {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.user-marker__dot {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #1a73e8;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
  position: relative;
}

.user-marker__dot::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  background: rgba(26, 115, 232, 0.28);
  z-index: -1;
  animation: pulse-ring 1.8s ease-out infinite;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.5);
    opacity: 0.85;
  }
  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  max-width: 88vw;
  padding: 11px 18px;
  border-radius: 10px;
  background: rgba(28, 33, 40, 0.92);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 2000;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Drag handle (hidden on desktop) ---------- */
.sheet-handle {
  display: none;
}

/* ---------- Responsive: bottom sheet ---------- */
@media (max-width: 760px) {
  .sidebar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    min-width: 0;
    height: 88dvh;
    border-right: none;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 28px rgba(20, 30, 50, 0.18);
    transform: translateY(calc(88dvh - 118px));
    transition: transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
    z-index: 1200;
    will-change: transform;
  }

  .sidebar.is-dragging {
    transition: none;
  }

  .sheet-handle {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 11px 0 7px;
    flex-shrink: 0;
    cursor: grab;
    touch-action: none;
  }

  .sheet-handle span {
    width: 42px;
    height: 5px;
    border-radius: 999px;
    background: #cdd3db;
  }

  .sidebar.is-dragging .sheet-handle {
    cursor: grabbing;
  }

  .sidebar__header {
    padding: 2px 24px 14px;
    touch-action: none;
    cursor: grab;
  }

  .map-wrap {
    height: 100dvh;
  }

  .toast {
    bottom: 134px;
  }
}
