:root {
  --accent: #3999af;
  --accent-ink: #0c242d;
  --accent-light: #88d7e4;
  --accent-link: #216d80;
  --focus-color: var(--accent-link);
  --map-background: #d0cfd4;
  font-family: system-ui, -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: #1a2632;
  background: var(--map-background);
}
:root:has(.poi-map[data-basemap="street"]) { --map-background: #aad3df; }
* { box-sizing: border-box; }
body, h1, h2, p, ul { margin: 0; }
body { background: var(--map-background); }
button, select, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}

.map-app {
  --sidebar-width: 362px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  position: fixed;
  inset: 0;
  overflow: hidden;
}
.poi-map { position: absolute; inset: 0; z-index: 0; background: var(--map-background); }
.fallback-basemap { filter: grayscale(1); }
.poi-map .leaflet-top.leaflet-left {
  left: calc(var(--safe-left) + var(--sidebar-width) + 14px);
  top: calc(var(--safe-top) + 6px);
}
.poi-map .leaflet-bottom.leaflet-right { right: var(--safe-right); bottom: var(--safe-bottom); }
.poi-map .leaflet-control-attribution { font-size: 10px; }
.poi-map .leaflet-control-attribution a { color: var(--accent-link); }
.map-actions[hidden], .place-details[hidden], .download-links > [hidden] { display: none; }
.map-actions {
  position: absolute;
  top: calc(var(--safe-top) + 91px);
  left: calc(var(--safe-left) + var(--sidebar-width) + 24px);
  z-index: 700;
  display: grid;
  gap: 8px;
}
.map-action {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  color: #1a2632;
  background: #fff;
  border: 2px solid #0003;
  border-radius: 5px;
  background-clip: padding-box;
}
.map-action:hover { background-color: #f4f4f4; }
.map-action:disabled { cursor: progress; }
.map-action[aria-busy="true"] svg { animation: map-location-spin 1s linear infinite; }
@keyframes map-location-spin { to { transform: rotate(360deg); } }
.map-location-message {
  position: absolute;
  top: 42px;
  left: 42px;
  width: max-content;
  max-width: min(260px, calc(100vw - var(--safe-left) - var(--safe-right) - var(--sidebar-width) - 78px));
  padding: 7px 10px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 8px #0002;
  font-size: 13px;
}
.map-location-message:empty { clip-path: inset(50%); }
.map-error {
  position: absolute;
  top: calc(var(--safe-top) + 16px);
  left: calc(var(--safe-left) + var(--sidebar-width) + 24px);
  padding: 8px 12px;
  background: #fffc;
  border-radius: 8px;
  font-size: 13px;
}

.poi-marker, .poi-cluster { display: grid; place-items: center; }
.pin-dot {
  width: 100%;
  height: 100%;
  transform: rotate(-45deg);
  background: var(--pin);
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  box-shadow: 0 2px 5px #0006;
}
.pin-approach { width: calc(100% - 4px); height: calc(100% - 4px); border-radius: 3px; }
.is-selected .pin-dot { box-shadow: 0 0 0 3px #18242e, 0 3px 8px #0007; }
.poi-cluster span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  font: 700 14px system-ui, sans-serif;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px #0005;
}

.directory {
  --focus-color: var(--accent-light);
  position: absolute;
  inset: calc(8px + var(--safe-top)) auto calc(8px + var(--safe-bottom)) calc(8px + var(--safe-left));
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: var(--sidebar-width);
  padding: 16px;
  color-scheme: dark;
  color: #f7f9fc;
  background: rgb(24 28 33 / .88);
  border: 1px solid #fff2;
  border-radius: 16px;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 35px #15212f42;
}
.directory-heading, .directory-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.brand-kicker { color: var(--accent-light); font-size: 12px; font-weight: 750; letter-spacing: .06em; }
.directory h1 { margin-top: 3px; font-size: 23px; line-height: 1.2; }
.source-toggle, .download-links > * {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 3px;
  min-height: 28px;
  padding: 4px 8px;
  color: inherit;
  background: #ffffff0b;
  border: 1px solid #fff3;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}
.filters { display: grid; gap: 8px; }
.source-toggle:hover, .download-links > :hover { background: #fff2; }
.source-toggle[aria-pressed="true"] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent-light);
}
.filter-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.filter-row > * {
  width: 100%;
  min-width: 0;
  min-height: 35px;
  padding: 5px 8px;
  color: inherit;
  background: #1e232b;
  border: 1px solid #fff3;
  border-radius: 8px;
  font-size: 13px;
  text-overflow: ellipsis;
}
.filter-row input::placeholder { color: #b7c1cc; }
.directory-tools { flex-wrap: wrap; }
.directory-tools output, .directory-credit { color: #d6dde5; font-size: 12px; }
.download-links { display: flex; gap: 5px; }
.directory-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #83919f #ffffff0b;
  border: 1px solid #fff2;
  border-radius: 9px;
  background: #14181d65;
}
.place-list, .article-directory ul, .place-sources { padding: 0; list-style: none; }
.place-list li + li, .article-directory li + li { border-top: 1px solid #fff2; }
.place-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  width: 100%;
  padding: 11px 10px;
  color: inherit;
  background: transparent;
  border: 0;
  text-align: left;
}
.place-row:focus-visible { outline-offset: -2px; }
.place-row:hover, .place-row[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.row-label, .row-meta { display: grid; gap: 3px; }
.row-label strong { overflow-wrap: anywhere; font-size: 14px; }
.row-label small, .row-meta small, .article-directory small { color: #c7d0db; font-size: 12px; }
.row-meta { text-align: right; }
.row-meta > span { display: flex; align-items: center; justify-content: end; gap: 4px; font-size: 12px; }
.list-dot { display: inline-block; width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; }
.list-dot { border: 1px solid #fff7; }
.no-results, .article-directory h2, .article-directory li { padding: 10px; font-size: 13px; }
.article-directory h2 { border-bottom: 1px solid #fff2; }
.article-directory li { display: grid; gap: 5px; }
.article-directory time { color: #c7d0db; font-size: 12px; }
.article-directory a { color: var(--accent-light); }
.sheet-handle { display: none; }

.place-details {
  position: absolute;
  color: #1a2632;
  background: rgb(255 255 255 / .91);
  border: 1px solid #fff;
  border-radius: 12px;
  box-shadow: 0 5px 20px #15212f35;
  backdrop-filter: blur(10px);
  z-index: 1000;
  left: calc(var(--safe-left) + var(--sidebar-width) + 24px);
  bottom: calc(var(--safe-bottom) + 16px);
  width: min(450px, calc(100% - var(--safe-left) - var(--safe-right) - var(--sidebar-width) - 40px));
  max-height: calc(100% - var(--safe-top) - var(--safe-bottom) - 32px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 15px;
  font-size: 13px;
  line-height: 1.55;
}
.detail-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #293945;
  background: #f3f5f8;
  border: 1px solid #c9d2db;
  border-radius: 8px;
}
.place-details h2 { padding-right: 28px; font-size: 20px; line-height: 1.3; }
.detail-meta, .address { margin-top: 5px; color: #455763; }
.address svg, .access-note svg, a svg { vertical-align: -.14em; }
.place-description { margin: 10px 0; padding-left: 10px; border-left: 3px solid; }
.access-note { margin: 8px 0; padding: 7px; background: #fff4db; border-radius: 6px; }
.access-note summary { cursor: pointer; }
.access-note small { color: #665735; }
.detail-links { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-meta + .detail-links, .address + .detail-links { margin-top: 10px; }
.place-details a { color: var(--accent-link); overflow-wrap: anywhere; }
.detail-links a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  background: #f2fafb;
  border: 1px solid #c9d2db;
  border-radius: 7px;
  text-decoration: none;
}
.detail-links a.primary-link { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.detail-links a:hover, .detail-close:hover { filter: brightness(.93); }
.place-sources { display: grid; gap: 4px; margin-top: 10px; }
.place-sources small { display: block; }

@media (max-width: 743px) {
  .poi-map .leaflet-top.leaflet-left { left: calc(var(--safe-left) + 6px); }
  .poi-map .leaflet-bottom.leaflet-right {
    top: calc(var(--safe-top) + 91px);
    bottom: auto;
    max-width: calc(100% - var(--safe-left) - var(--safe-right) - 60px);
  }
  .map-app:has(.place-details:not([hidden])) .poi-map .leaflet-bottom.leaflet-right {
    top: calc(44% + var(--safe-top) + 12px);
    max-width: calc(100% - var(--safe-left) - var(--safe-right));
  }
  .map-actions, .map-error { left: calc(var(--safe-left) + 16px); }
  .map-location-message { max-width: calc(100vw - var(--safe-left) - var(--safe-right) - 74px); }
  .directory {
    inset: auto calc(8px + var(--safe-right)) calc(8px + var(--safe-bottom)) calc(8px + var(--safe-left));
    gap: 8px;
    width: auto;
    padding: 0 11px 11px;
    max-height: calc(100% - var(--safe-top) - var(--safe-bottom) - 16px);
    overflow: auto;
  }
  .directory.is-open { top: calc(8px + var(--safe-top)); }
  .sheet-handle {
    display: grid;
    flex: 0 0 24px;
    width: 100%;
    place-items: center;
    padding: 0;
    color: inherit;
    background: transparent;
    border: 0;
  }
  .sheet-handle span { width: 36px; height: 4px; background: #c0c8d2; border-radius: 9px; }
  .directory h1 { font-size: 20px; }
  .filter-row > * { font-size: 16px; }
  .directory:not(.is-open) .directory-content, .directory:not(.is-open) .directory-credit { display: none; }
  .place-details {
    inset: calc(8px + var(--safe-top)) calc(8px + var(--safe-right)) auto calc(8px + var(--safe-left));
    width: auto;
    max-height: 44%;
  }
}

@media (max-width: 743px) and (max-height: 460px) {
  .map-actions {
    top: calc(var(--safe-top) + 16px);
    left: calc(var(--safe-left) + 58px);
    grid-auto-flow: column;
  }
  .map-location-message { left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .poi-map *, .poi-map *::before, .poi-map *::after { transition-duration: 0s !important; }
  .map-action[aria-busy="true"] svg { animation: none; }
}
