:root {
  --bg: #f3f4f6;
  --bg-1: #f3f4f6;
  --bg-2: #f3f4f6;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-strong: rgba(255, 255, 255, 0.98);
  --ink: #111827;
  --muted: #6b7280;
  --accent: #0f766e;
  --accent-2: #14b8a6;
  --line: rgba(17, 24, 39, 0.08);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111827;
    --bg-1: #111827;
    --bg-2: #111827;
    --panel: rgba(31, 41, 55, 0.96);
    --panel-strong: rgba(31, 41, 55, 0.98);
    --ink: #f3f4f6;
    --muted: #9ca3af;
    --accent: #2dd4bf;
    --accent-2: #14b8a6;
    --line: rgba(255, 255, 255, 0.08);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.12);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  color: var(--ink);
  font-size: 16px;
  background: var(--bg);
}

body::before,
body::after {
  display: none;
}

header {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 14px 18px 12px;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid rgba(17, 24, 39, 0.06);
  background: rgba(243, 244, 246, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: riseIn 0.45s ease both;
}

/* マップ上のローディングオーバーレイ（.layout直下） */
.map-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(246, 238, 225, 0.85);
  z-index: 1100;
  pointer-events: auto;
  transition: opacity 0.3s ease;
}

.map-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.map-loading-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  background: var(--panel-strong);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(16, 36, 61, 0.15);
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* マップ空状態メッセージ（.layout直下） */
.map-empty-state {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--panel-strong);
  padding: 18px 28px;
  border-radius: 14px;
  text-align: center;
  font-weight: 700;
  color: var(--muted);
  z-index: 1050;
  box-shadow: var(--shadow);
  pointer-events: none;
}

.map-empty-state p { margin: 0; }
.map-empty-hint { font-size: 13px; font-weight: 400; margin-top: 6px !important; }

/* overscroll防止（PWAでpull-to-refresh干渉回避） */
body, .side, main {
  overscroll-behavior: contain;
}

/* タップ応答改善: 300ms遅延除去 */
button, .card, .mobile-tab, .controls-toggle, .region-header, a {
  touch-action: manipulation;
}

/* Leaflet ポップアップ閉じるボタン拡大 */
.leaflet-popup-close-button {
  width: 32px !important;
  height: 32px !important;
  font-size: 22px !important;
  line-height: 32px !important;
  padding: 0 !important;
  right: 4px !important;
  top: 4px !important;
}

h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.01em;
  font-weight: 700;
}

.sub {
  margin-top: 5px;
  font-size: 14px;
  color: var(--muted);
}

#dateText {
  display: none;
}

.description {
  margin: 6px 0 0;
  font-size: 16px;
  color: var(--muted);
  line-height: 1.5;
}

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 350px 1fr;
  height: calc(var(--vh, 1vh) * 100 - 74px);
  gap: 12px;
  padding: 12px;
}

.side {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: auto;
  animation: riseIn 0.5s ease both;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.side::-webkit-scrollbar {
  width: 6px;
}

.side::-webkit-scrollbar-track {
  background: transparent;
}

.side::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.side::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

.controls,
.list {
  padding: 14px;
}

.list {
  content-visibility: auto;
  contain: layout style;
}

label,
input,
button {
  display: block;
  width: 100%;
}

label {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

#nearbyBtn {
  margin-top: 8px;
  margin-bottom: 6px;
}

.reset-btn {
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  border: 1px solid var(--line);
  box-shadow: none;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  margin-bottom: 10px;
}

.reset-btn:hover {
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  box-shadow: none;
  transform: none;
}

#nearbyBtn.active {
  background: #d97706;
  box-shadow: none;
}

.search-wrap {
  position: relative;
  margin-bottom: 12px;
}

#searchInput {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  margin-bottom: 0;
  font-size: 16px;
  background: var(--panel-strong);
  color: var(--ink);
}

#searchInput::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.autocomplete {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 0 0 12px 12px;
  box-shadow: 0 8px 20px rgba(16, 36, 61, 0.15);
  max-height: 200px;
  overflow-y: auto;
}

.autocomplete.hidden {
  display: none;
}

.ac-item {
  padding: 10px 12px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ac-item:hover {
  background: rgba(0, 93, 115, 0.08);
}

.ac-item:last-child {
  border-bottom: none;
}


/* Favorite button */


/* マップ上検索バー */
.map-search {
  position: absolute;
  top: 10px;
  left: 50px;
  right: 60px;
  z-index: 1000;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 0 12px;
  height: 44px;
}

.map-search__icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: #9ca3af;
}

.map-search__input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  padding: 10px 8px !important;
  margin: 0 !important;
  font-size: 14px !important;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  min-width: 0;
  min-height: 0 !important;
  box-shadow: none !important;
  width: auto !important;
}

.map-search__input::placeholder {
  color: #9ca3af;
}

.map-search__input:focus,
.map-search__input:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.map-search__input::-webkit-search-cancel-button,
.map-search__input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.map-search__clear {
  width: 28px !important;
  height: 28px !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 50% !important;
  background: #f3f4f6 !important;
  color: #6b7280 !important;
  font-size: 16px;
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-height: 0 !important;
  box-shadow: none !important;
}

.map-search__results {
  position: absolute;
  top: 48px;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-height: 300px;
  overflow-y: auto;
}

.map-search__item {
  padding: 12px 14px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(17, 24, 39, 0.06);
  display: flex;
  align-items: center;
  gap: 10px;
}

.map-search__item:last-child { border-bottom: none; }
.map-search__item:hover { background: rgba(15, 118, 110, 0.06); }

.map-search__item-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: #9ca3af;
}

.map-search__item--event .map-search__item-icon { color: #0f766e; }
.map-search__item--place .map-search__item-icon { color: #9ca3af; }

.map-search__item-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-search__item-sub {
  font-size: 12px;
  color: #9ca3af;
  white-space: nowrap;
}

/* Locate control (Google Maps style - bottom right) */
.locate-control {
  margin-bottom: 10px !important;
  margin-right: 10px !important;
}

/* Map preset buttons overlay */
.map-presets {
  position: absolute;
  top: 62px;
  right: 10px;
  z-index: 1000;
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
}

.map-presets button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: auto !important;
  padding: 6px 12px !important;
  font-size: 12px !important;
  font-weight: 600;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.95) !important;
  color: var(--ink) !important;
  border: 1px solid var(--line) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
  min-height: 0 !important;
  white-space: nowrap;
}

.map-presets button:hover {
  background: white !important;
  transform: none;
}

.map-presets button.active {
  background: rgba(15, 118, 110, 0.10) !important;
  color: var(--accent) !important;
  border-color: rgba(15, 118, 110, 0.28) !important;
}

.map-presets .map-date-range-btn {
  background: rgba(255, 255, 255, 0.95) !important;
  color: var(--ink) !important;
  border: 1px solid var(--line) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

.map-presets .map-date-range-btn:hover {
  background: white !important;
}

.map-presets .map-date-range-btn.active {
  background: rgba(15, 118, 110, 0.10) !important;
  color: var(--accent) !important;
  border-color: rgba(15, 118, 110, 0.28) !important;
}

/* Map date range picker */
.map-date-picker {
  position: absolute;
  top: 46px;
  right: 10px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.map-date-picker label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  width: auto;
}

.map-date-picker input[type="date"] {
  padding: 6px 8px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-height: 0;
  width: auto;
}

.map-date-picker button {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  min-height: 0;
  width: auto;
}

.map-date-clear {
  background: transparent !important;
  color: var(--muted) !important;
  border: 1px solid #d1d5db !important;
}

.map-date-clear:hover {
  background: #f9fafb !important;
  color: var(--ink) !important;
}

/* Skeleton loading cards */
.skeleton-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  background: var(--panel-strong);
}

.sk-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--line) 25%, rgba(255,255,255,0.5) 50%, var(--line) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  margin-bottom: 8px;
}

.sk-title {
  width: 75%;
  height: 18px;
}

.sk-meta {
  width: 60%;
}

.sk-meta.short {
  width: 40%;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.date-range {
  display: flex;
  align-items: end;
  gap: 6px;
  margin-top: 4px;
  margin-bottom: 8px;
}

.date-field {
  flex: 1;
  min-width: 0;
}

.date-field label {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 2px;
}

.date-separator {
  font-size: 16px;
  color: var(--muted);
  padding-bottom: 10px;
}

input[type="date"] {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 8px;
  font-size: 14px;
  background: var(--panel-strong);
  color: var(--ink);
  font-family: inherit;
}

.date-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.date-presets button {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
  box-shadow: none;
  width: auto;
  transition: all 140ms ease;
}

.date-presets button:hover {
  border-color: #9ca3af;
  background: #f9fafb;
  color: #374151;
  box-shadow: none;
}

.date-presets button.active {
  background: rgba(15, 118, 110, 0.10);
  color: var(--accent);
  border-color: rgba(15, 118, 110, 0.28);
}

input[type="text"],
input[type="number"] {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  margin-top: 6px;
  margin-bottom: 12px;
  font-size: 16px;
  background: var(--panel-strong);
  color: var(--ink);
}

input[type="checkbox"] {
  width: auto;
  display: inline;
  margin-right: 7px;
  accent-color: var(--accent-2);
}

button {
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s ease;
}

button:hover {
  background: var(--accent-2);
  transform: none;
  box-shadow: none;
}

button:active {
  transform: none;
  box-shadow: none;
  filter: brightness(0.95);
}

:focus-visible {
  outline: 3px solid var(--accent-2);
  outline-offset: 2px;
}

button:focus-visible {
  outline-offset: 3px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  background: var(--panel-strong);
  box-shadow: none;
  opacity: 1;
}

.card:nth-child(-n+8) {
  animation: cardIn 0.25s ease both;
  animation-delay: calc(var(--i, 0) * 20ms);
}

.card.highlight {
  background: rgba(15, 118, 110, 0.06);
  border-color: var(--accent);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.card h3 {
  margin: 0 0 4px 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.card a {
  color: var(--accent);
  font-weight: 700;
}

.day-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  margin-right: 6px;
  vertical-align: middle;
  letter-spacing: 0.04em;
}

.day-badge.today {
  background: #e63946;
  color: white;
}

.day-badge.tomorrow {
  background: #f4a261;
  color: white;
}

.category-tag {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  border-radius: 999px;
  border: 1px solid transparent;
  margin-left: 4px;
  vertical-align: middle;
}

.category-tag.cat-story { color: #92400e; background: #fffbeb; border-color: #fde68a; }
.category-tag.cat-craft { color: #3730a3; background: #eef2ff; border-color: #c7d2fe; }
.category-tag.cat-music { color: #6b21a8; background: #faf5ff; border-color: #e9d5ff; }
.category-tag.cat-sports { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }
.category-tag.cat-baby { color: #0f766e; background: #ecfeff; border-color: #a5f3fc; }
.category-tag.cat-food { color: #92400e; background: #fff7ed; border-color: #fed7aa; }
.category-tag.cat-nature { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }
.category-tag.cat-consultation { color: #1e40af; background: #eff6ff; border-color: #bfdbfe; }

.no-map-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(63, 85, 109, 0.12);
  color: var(--muted);
  margin-left: 4px;
  vertical-align: middle;
}

.meta {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
  font-size: 12px;
}

.card-actions a {
  color: var(--accent);
  font-weight: 700;
}

.cal-btn, .route-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--ink);
  border: 1px solid var(--line);
  text-decoration: none;
}

.cal-btn:hover, .route-btn:hover {
  background: var(--accent);
  color: white;
}

.share-btn {
  width: auto;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
  min-height: 0;
}

.share-btn:hover {
  background: var(--accent);
  color: white;
  transform: none;
  box-shadow: none;
}

main {
  position: relative;
}

#map {
  height: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: riseIn 0.56s ease both;
  contain: layout style;
}

.leaflet-popup-content-wrapper {
  border-radius: 14px !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.04) !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", sans-serif;
}

.popup-content {
  padding: 14px 16px;
}

.popup-title {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.4;
  color: var(--ink);
  margin-bottom: 6px;
}

.popup-meta {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.popup-address {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 2px;
}

.popup-actions {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.popup-actions__row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.popup-action {
  min-height: 42px;
  border-radius: 8px;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  border: 1px solid transparent;
}

.popup-action svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.popup-action--primary {
  width: 100%;
  padding: 10px 12px;
  background: var(--accent) !important;
  color: #fff !important;
}

.popup-action--primary:hover,
.popup-action--primary:focus-visible {
  filter: brightness(0.92);
}

.popup-action--secondary {
  padding: 10px 8px;
  background: color-mix(in srgb, var(--accent) 10%, var(--bg)) !important;
  color: var(--ink) !important;
  border-color: color-mix(in srgb, var(--accent) 24%, var(--bg));
}

.popup-action--secondary:hover,
.popup-action--secondary:focus-visible {
  background: color-mix(in srgb, var(--accent) 18%, var(--bg)) !important;
}

/* マーカークラスターのカスタムスタイル */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background: rgba(15, 118, 110, 0.18) !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background: #0f766e !important;
  color: #fff !important;
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 700;
  font-size: 13px;
}

.marker-cluster-medium {
  background: rgba(15, 118, 110, 0.22) !important;
}

.marker-cluster-medium div {
  background: #0d5c56 !important;
}

.marker-cluster-large {
  background: rgba(15, 118, 110, 0.28) !important;
}

.marker-cluster-large div {
  background: #094b46 !important;
}

/* ピンツールチップ（PC hover） */
.pin-tooltip {
  font-family: "Noto Sans JP", sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--line);
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-pin-wrap {
  background: transparent;
  border: 0;
}

.event-pin {
  width: 28px;
  height: 40px;
  display: block;
}

.event-pin-selected .event-pin {
  width: 42px;
  height: 58px;
  animation: pinBounce 0.3s ease;
}

@keyframes pinBounce {
  0% { transform: scale(0.7); }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Region / prefecture filters */
.region-section {
  margin-top: 4px;
  margin-bottom: 4px;
}

.region-filter-title {
  font-size: 14px;
  font-weight: 700;
  color: #17324b;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.region-filter-title::-webkit-details-marker {
  display: none;
}

.region-filter-title::before {
  content: "\25B6";
  font-size: 10px;
  transition: transform 0.2s ease;
}

.region-section[open] > .region-filter-title::before {
  transform: rotate(90deg);
}

.region-bulk {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 9px;
  margin-top: 8px;
}

.region-bulk button {
  margin: 0;
  padding: 8px 10px;
  font-size: 14px;
}

.region-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 8px;
  overflow: hidden;
}

.region-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  cursor: pointer;
  list-style: none;
}

.region-header::-webkit-details-marker {
  display: none;
}

.region-header::after {
  content: "\25B6";
  font-size: 9px;
  margin-left: auto;
  transition: transform 0.2s ease;
  color: var(--muted);
}

.region-group[open] > .region-header::after {
  transform: rotate(90deg);
}

.region-header input[type="checkbox"] {
  margin: 0;
}

.region-header .region-count {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 2px;
}

.pref-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
  padding: 6px 8px 8px;
}

.pref-option {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 6px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
}

.pref-option input[type="checkbox"] {
  margin: 0;
}

.pref-option .pref-count {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-left: auto;
  white-space: nowrap;
}

.pref-list-flat {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pref-list-flat .pref-option {
  flex: 0 0 auto;
}

.loading {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 10px;
}

.group-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 8px 12px;
  margin: 0 -14px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.group-header:not(:first-child) {
  margin-top: 6px;
}

.controls > * {
  animation: fadeUp 0.36s ease both;
}

.controls > *:nth-child(1) {
  animation-delay: 0.05s;
}
.controls > *:nth-child(2) {
  animation-delay: 0.1s;
}
.controls > *:nth-child(3) {
  animation-delay: 0.15s;
}
.controls > *:nth-child(4) {
  animation-delay: 0.2s;
}
.controls > *:nth-child(5) {
  animation-delay: 0.25s;
}
.controls > *:nth-child(6) {
  animation-delay: 0.3s;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-color-scheme: dark) {
  body {
    background: var(--bg);
  }
  header { background: rgba(17, 24, 39, 0.85); }
  .side { background: var(--panel); }
  .card { background: var(--panel); }
  .card.highlight { background: rgba(45, 212, 191, 0.08); }
  .group-header { background: var(--bg); }
  input[type="date"], input[type="text"], input[type="number"], #searchInput {
    background: rgba(31, 41, 55, 0.9);
    color: var(--ink);
    border-color: var(--line);
  }
  .map-search { background: rgba(31, 41, 55, 0.96); border-color: var(--line); }
  .map-search__results { background: rgba(31, 41, 55, 0.98); border-color: var(--line); }
  .map-search__clear { background: rgba(55, 65, 81, 0.8) !important; color: var(--ink) !important; }
  .map-search__item:hover { background: rgba(45, 212, 191, 0.08); }
  .date-presets button, .share-btn, .reset-btn, .map-presets button, .map-presets .map-date-range-btn {
    background: rgba(31, 41, 55, 0.8) !important;
    color: var(--ink) !important;
    border-color: var(--line) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
  }
  .date-presets button.active, .map-presets button.active, .map-presets .map-date-range-btn.active {
    background: rgba(45, 212, 191, 0.12) !important;
    color: var(--accent) !important;
    border-color: rgba(45, 212, 191, 0.3) !important;
  }
  .map-date-picker {
    background: rgba(31, 41, 55, 0.96);
    border-color: var(--line);
  }
  .map-date-picker input[type="date"] {
    background: rgba(17, 24, 39, 0.9);
    color: var(--ink);
    border-color: var(--line);
  }
  .map-date-clear {
    background: transparent !important;
    color: var(--muted) !important;
    border-color: var(--line) !important;
  }
  .popup-action--secondary {
    background: rgba(31, 41, 55, 0.8) !important;
    color: var(--ink) !important;
    border-color: var(--line) !important;
  }
  .popup-action--secondary:hover {
    background: rgba(55, 65, 81, 0.9) !important;
  }
  .autocomplete { background: var(--panel-strong); }
  .skeleton-card { background: var(--panel); }
  .sk-line { background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
  .region-header { background: rgba(45, 212, 191, 0.06); }
  .region-filter-title { color: var(--ink); }
  .pref-option { background: rgba(31, 41, 55, 0.65); border-color: var(--line); }
  .leaflet-popup-content-wrapper { background: var(--panel-strong) !important; }
  .popup-title { color: var(--ink); }
  .map-loading { background: rgba(17, 24, 39, 0.85); }
  .map-empty-state { background: var(--panel); }
  /* マップタイルをダークモードに合わせて減光 */
  .leaflet-tile-pane { filter: brightness(0.8) contrast(1.1) saturate(0.8); }
  .leaflet-control-zoom a { background: rgba(31, 41, 55, 0.9) !important; color: var(--ink) !important; border-color: var(--line) !important; }
  .locate-control a { background: rgba(31, 41, 55, 0.9) !important; color: var(--ink) !important; border-radius: 50% !important; }
  .card-actions { border-top-color: rgba(255, 255, 255, 0.06); }
  .side { scrollbar-color: #4b5563 transparent; }
  .side::-webkit-scrollbar-thumb { background: #4b5563; }
  .category-tag { border-color: transparent; }
  .cat-baby { color: #2dd4bf; background: rgba(45, 212, 191, 0.1); }
  .cat-story { color: #fbbf24; background: rgba(251, 191, 36, 0.1); }
  .cat-craft { color: #a5b4fc; background: rgba(165, 180, 252, 0.1); }
  .cat-music { color: #c084fc; background: rgba(192, 132, 252, 0.1); }
  .cat-sports { color: #86efac; background: rgba(134, 239, 172, 0.1); }
  .cat-food { color: #fdba74; background: rgba(253, 186, 116, 0.1); }
  .cat-nature { color: #86efac; background: rgba(134, 239, 172, 0.1); }
  .cat-consultation { color: #93c5fd; background: rgba(147, 197, 253, 0.1); }
  .list-sheet-btn, .filter-sheet-btn {
    background: var(--panel-strong);
    color: var(--ink);
    border-color: var(--line);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* モバイルタブバー（デスクトップでは非表示） */
.mobile-tabs {
  display: none;
}

/* フィルター折りたたみ（デスクトップではトグル非表示） */
.controls-section {
  border: none;
}

.controls-toggle {
  display: none;
}

@media (max-width: 900px) {
  .mobile-tabs {
    display: none !important;
  }

  header {
    padding: 10px 14px 8px;
  }

  header {
    padding: 8px 14px 6px;
    padding-top: calc(6px + env(safe-area-inset-top, 0px));
  }

  h1 {
    font-size: 16px;
  }

  .description {
    display: none;
  }

  .layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
    height: calc(var(--vh, 1vh) * 100 - var(--header-h, 46px));
  }

  .side {
    display: none;
  }

  main {
    display: block !important;
    height: 100%;
  }

  main #map {
    height: 100%;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }

  .controls-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    cursor: pointer;
    list-style: none;
    border-bottom: 1px solid var(--line);
  }

  .controls-toggle::-webkit-details-marker {
    display: none;
  }

  .controls-toggle::before {
    content: "\25B6";
    font-size: 10px;
    transition: transform 0.2s ease;
  }

  .controls-section[open] > .controls-toggle::before {
    transform: rotate(90deg);
  }

  .controls-section[open] > .controls-toggle {
    border-bottom: 1px solid var(--line);
  }

  .controls-section:not([open]) > .controls-toggle {
    border-bottom: none;
  }

  .mobile-tab .tab-badge {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.85;
  }

  /* タッチ最適化: 44px minimum tap target */
  button,
  input[type="date"] {
    min-height: 44px;
  }

  .date-presets button {
    padding: 10px 4px;
    font-size: 13px;
  }


  .map-presets {
    top: auto;
    bottom: 70px;
    right: 50%;
    transform: translateX(50%);
  }

  .map-presets button {
    padding: 8px 12px;
    min-height: 36px;
    font-size: 13px;
  }

  .map-date-picker {
    top: auto;
    bottom: 112px;
    right: 50%;
    transform: translateX(50%);
    flex-wrap: wrap;
    justify-content: center;
    max-width: 90vw;
  }

  .pref-option {
    padding: 8px 6px;
    min-height: 44px;
  }

  .card {
    padding: 14px;
  }

  /* カード内リンク: タップ領域確保 */
  .card-actions a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 4px 0;
  }

  /* 日付inputが小画面で溢れない */
  .date-range {
    flex-wrap: wrap;
  }

  .date-field {
    min-width: 120px;
  }

  /* Leafletコントロールがタブバーと重ならない */
  .leaflet-bottom {
    bottom: 10px !important;
  }

  /* タブバー分の余白を確保（safe-area含む） */
  .list {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  }

  /* 現在地ボタン: 44px最小タップ領域、タブバーの上 */
  .locate-control {
    margin-bottom: 70px !important;
  }
  .locate-control a {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
  }
}

/* マップ上の一覧・フィルターボタン（モバイル） */
.list-sheet-btn,
.filter-sheet-btn {
  position: fixed;
  z-index: 1200;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--panel-strong);
  color: var(--ink);
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.list-sheet-btn {
  bottom: 20px;
  left: 16px;
}

.filter-sheet-btn {
  bottom: 20px;
  right: 16px;
}

/* 一覧・フィルターシートはバックドロップ有効 */
#listSheet,
#filterSheet {
  pointer-events: auto;
}

#listSheet .bottom-sheet__backdrop,
#filterSheet .bottom-sheet__backdrop {
  display: block;
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.2);
  transition: opacity 0.2s ease;
}

/* イベント一覧シート */
.list-sheet__panel {
  max-height: 75vh !important;
}

.list-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 10px;
  border-bottom: 1px solid var(--line);
}

.list-sheet__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.list-sheet__body {
  overflow-y: auto;
  max-height: calc(75vh - 60px);
  padding: 8px 12px 24px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.list-sheet__body::-webkit-scrollbar { width: 4px; }
.list-sheet__body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }

/* フィルターシート */
.filter-sheet__panel {
  max-height: 80vh !important;
}

.filter-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 10px;
  border-bottom: 1px solid var(--line);
}

.filter-sheet__close {
  padding: 6px 14px !important;
  font-size: 13px !important;
  font-weight: 600;
  border-radius: 999px;
  background: transparent !important;
  color: var(--accent) !important;
  border: 1px solid var(--line) !important;
  box-shadow: none !important;
  min-height: 0 !important;
  width: auto !important;
}

.filter-sheet__body {
  overflow-y: auto;
  max-height: calc(80vh - 60px);
  padding: 14px 16px 24px;
  -webkit-overflow-scrolling: touch;
}

/* 一覧シート空状態 */
.list-sheet__empty {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 8px;
  padding: 32px 20px;
  color: var(--muted);
}

.list-sheet__empty p {
  margin: 0;
}

.list-sheet__empty p:first-child {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.list-sheet__empty-hint {
  font-size: 13px;
}

.list-sheet__empty-reset {
  margin-top: 8px;
  padding: 8px 20px !important;
  font-size: 13px !important;
  border-radius: 999px;
  width: auto !important;
}

/* ボトムシート（モバイルポップアップ） */
.bottom-sheet {
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
}

.bottom-sheet__backdrop {
  display: none;
}

.bottom-sheet__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 60vh;
  background: var(--panel-strong);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.15), 0 -1px 3px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  pointer-events: auto;
}

.bottom-sheet[data-open] .bottom-sheet__panel {
  transform: translateY(0);
}

.bottom-sheet[data-closing] .bottom-sheet__panel {
  transform: translateY(100%);
}

.bottom-sheet[data-closing] .bottom-sheet__backdrop {
  opacity: 0;
}

.bottom-sheet__handle {
  width: 36px;
  height: 4px;
  margin: 10px auto 4px;
  border-radius: 999px;
  background: #d1d5db;
}

.bottom-sheet__body {
  padding: 8px 16px 20px;
  overflow-y: auto;
  max-height: calc(60vh - 28px);
}

.bottom-sheet__body .popup-content {
  padding: 0;
}

.bottom-sheet__body .popup-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.45;
  margin-bottom: 8px;
}

.bottom-sheet__body .popup-meta {
  font-size: 14px;
  line-height: 1.6;
}

.bottom-sheet__body .popup-actions {
  margin-top: 14px;
  padding-top: 12px;
}

.bottom-sheet__body .popup-action {
  min-height: 48px;
  font-size: 14px;
}

.bottom-sheet__body .popup-actions__row {
  gap: 10px;
}

@media (prefers-color-scheme: dark) {
  .bottom-sheet__panel { background: var(--panel-strong); }
  .bottom-sheet__handle { background: #4b5563; }
}

/* フッター免責事項 */
.site-footer {
  background: var(--panel-strong);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}
.site-footer a {
  color: var(--accent);
  text-decoration: underline;
}

/* 横画面: ヘッダーを最小化して地図エリアを確保 */
@media (max-width: 900px) and (orientation: landscape) {
  header {
    padding-top: calc(4px + env(safe-area-inset-top, 0px));
    padding-bottom: 4px;
  }
  h1 { font-size: 16px; }
  .mobile-tab { padding: 8px 0; }
}

/* Footer area links for SEO */
.footer-area-links {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.footer-area-links h2 {
  font-size: 0.85em;
  color: var(--muted);
  margin: 0 0 10px;
  font-weight: 600;
}
.area-link-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.area-link-group {
  font-size: 0.78em;
  line-height: 1.8;
}
.area-link-group > a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.area-link-group > a:hover {
  text-decoration: underline;
}
.area-sub-links {
  margin-left: 2px;
}
.area-sub-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92em;
}
.area-sub-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.area-sub-links a::before {
  content: "・";
  color: var(--line);
}
