html, body { margin: 0; padding: 0; overflow: hidden; }
.map-unsupported {
  height: 100%;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--edt-bg-elev-1, #fbf6ec);
  color: var(--edt-fg, #2a241c);
  text-align: center;
  font: 600 1rem/1.45 Arial, sans-serif;
}

/* =========================================================================
   Context menu
   ========================================================================= */
.map-context-menu {
  position: absolute;
  z-index: var(--edt-z-popover);
  min-width: 190px;
  background: var(--edt-bg-elev-1, #fbf6ec);
  border: 1px solid var(--edt-control-border, #94875f);
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.14), 0 1px 4px rgba(0,0,0,0.07);
  padding: 4px 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.875em;
  user-select: none;
}
.ctx-item {
  padding: 8px 16px;
  cursor: pointer;
  color: var(--edt-fg, #2a241c);
  white-space: nowrap;
  transition: background var(--edt-dur-1);
}
.ctx-item:hover { background: var(--edt-bg-chip, #ebe3d0); }
.ctx-new   { color: var(--edt-accent, #246765); font-weight: 600; }
.ctx-sep {
  height: 1px;
  background: var(--edt-line, #e3dac4);
  margin: 3px 0;
}

.mobile-place-fab {
  display: none;
}

/* =========================================================================
   Reader landing
   ========================================================================= */
.reader-landing[hidden] {
  display: none !important;
}
.reader-landing {
  position: fixed;
  inset: 0;
  z-index: var(--edt-z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(34, 30, 24, 0.34);
  backdrop-filter: blur(2px);
}
.reader-landing-card {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  box-sizing: border-box;
  padding: 24px;
  border-radius: 8px;
  background: var(--edt-bg, #f6f1e7);
  color: var(--edt-fg, #2a241c);
  border: 1px solid var(--edt-line-strong, #cfc2a4);
  box-shadow: 0 18px 50px rgba(30, 24, 16, 0.24);
  font-family: var(--edt-font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}
.reader-landing-kicker {
  margin: 0 0 8px;
  color: var(--edt-accent, #2f7a78);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}
.reader-landing h1 {
  margin: 0;
  font-size: 1.8rem;
  line-height: 1.1;
  letter-spacing: 0;
}
.reader-landing-copy {
  margin: 8px 0 20px;
  color: var(--edt-fg-muted, #6f6555);
  font-size: 1rem;
}
.reader-landing-login {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--edt-line, #e3dac4);
  background: var(--edt-bg-elev-1, #fbf6ec);
  color: var(--edt-fg-muted, #6f6555);
  transition: background var(--edt-dur-1), border-color var(--edt-dur-1), color var(--edt-dur-1), box-shadow var(--edt-dur-1);
}
.reader-landing-login:hover,
.reader-landing-login:focus-visible {
  outline: none;
  border-color: var(--edt-accent-border, #afd0ce);
  background: var(--edt-accent-soft-2, #e6f1f0);
  color: var(--edt-accent, #2f7a78);
  box-shadow: 0 0 0 3px var(--edt-accent-ring, rgba(47, 122, 120, 0.22));
}
.reader-landing-search {
  margin: 0 0 14px;
}
.reader-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--edt-line, #e3dac4);
  background: var(--edt-bg-elev-1, #fbf6ec);
  color: var(--edt-fg, #2a241c);
  font: inherit;
}
.reader-search-input:focus-visible {
  outline: none;
  border-color: var(--edt-accent-border, #afd0ce);
  box-shadow: 0 0 0 3px var(--edt-accent-ring, rgba(47, 122, 120, 0.22));
}
.reader-search-input:disabled {
  cursor: wait;
  opacity: 0.64;
}
.reader-search-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  margin-top: 8px;
  overflow-y: auto;
}
.reader-search-results[hidden] {
  display: none;
}
.reader-search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--edt-line, #e3dac4);
  background: var(--edt-bg-elev-1, #fbf6ec);
  color: var(--edt-fg, #2a241c);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--edt-dur-1), border-color var(--edt-dur-1), box-shadow var(--edt-dur-1);
}
.reader-search-result:hover,
.reader-search-result:focus-visible {
  outline: none;
  border-color: var(--edt-accent-border, #afd0ce);
  background: var(--edt-accent-soft-2, #e6f1f0);
  box-shadow: 0 0 0 3px var(--edt-accent-ring, rgba(47, 122, 120, 0.22));
}
.reader-search-result:disabled {
  cursor: wait;
  opacity: 0.64;
}
.reader-search-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reader-search-level {
  flex-shrink: 0;
  color: var(--edt-fg-muted, #6f6555);
  font-size: 0.78rem;
  text-transform: uppercase;
}
.reader-search-empty {
  margin: 0;
  padding: 6px 2px;
  color: var(--edt-fg-muted, #6f6555);
  font-size: 0.88rem;
}
.reader-city-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.reader-city-card {
  min-height: 82px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--edt-line, #e3dac4);
  background: var(--edt-bg-elev-1, #fbf6ec);
  color: var(--edt-fg, #2a241c);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--edt-dur-1), border-color var(--edt-dur-1), transform var(--edt-dur-1), box-shadow var(--edt-dur-1);
}
.reader-city-card:hover,
.reader-city-card:focus-visible {
  outline: none;
  border-color: var(--edt-accent-border, #afd0ce);
  background: var(--edt-accent-soft-2, #e6f1f0);
  box-shadow: 0 0 0 3px var(--edt-accent-ring, rgba(47, 122, 120, 0.22));
  transform: translateY(-1px);
}
.reader-city-card:disabled {
  cursor: wait;
  opacity: 0.64;
  transform: none;
}
.reader-city-name {
  font-weight: 700;
  font-size: 1.02rem;
}
.reader-city-detail {
  color: var(--edt-fg-muted, #6f6555);
  font-size: 0.88rem;
}
.reader-landing-status {
  min-height: 1.2em;
  margin: 14px 0 0;
  color: var(--edt-fg-muted, #6f6555);
  font-size: 0.88rem;
  opacity: 0;
}
.reader-landing.is-loading .reader-landing-status {
  opacity: 1;
}
@media (max-width: 560px) {
  .reader-landing {
    align-items: flex-end;
    padding: 16px;
  }
  .reader-landing-card {
    width: 100%;
    padding: 20px;
  }
  .reader-landing h1 {
    font-size: 1.45rem;
  }
  .reader-city-grid {
    grid-template-columns: 1fr;
  }
  .reader-city-card {
    min-height: 64px;
  }
}

/* =========================================================================
   Map controls & popups
   ========================================================================= */
.kokoroad-map-control {
  position: absolute;
  z-index: var(--edt-z-map-control);
  display: flex;
  gap: 10px;
  pointer-events: none;
}
.kokoroad-map-control > * {
  pointer-events: auto;
}
.kokoroad-map-control-topleft,
.kokoroad-map-control-topright {
  top: 12px;
  flex-direction: column;
}
.kokoroad-map-control-bottomleft,
.kokoroad-map-control-bottomright {
  /* Clear MapLibre's always-visible attribution links at the viewport edge. */
  bottom: 48px;
  flex-direction: column-reverse;
}
.kokoroad-map-control-topleft,
.kokoroad-map-control-bottomleft {
  left: 12px;
  align-items: flex-start;
}
.kokoroad-map-control-topright,
.kokoroad-map-control-bottomright {
  right: 12px;
  align-items: flex-end;
}
.maplibregl-popup-content {
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.06);
  padding: 14px 16px;
}
.maplibregl-popup-tip { box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08); }

.layer-panel {
  background: var(--edt-bg-elev-1, #fbf6ec);
  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  padding: 8px 0 6px;
  min-width: 148px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.layer-panel-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  color: var(--edt-fg-muted, #665c4d);
  padding: 0 12px 6px;
  margin-bottom: 4px;
  font: inherit;
  cursor: default;
  text-align: left;
}
.layer-panel-toggle-icon,
.layer-panel-chevron {
  display: none;
  flex-shrink: 0;
}
.layer-panel-toggle-label {
  font-size: 0.7em;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.layer-panel-body {
  display: block;
}
.layer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 0.85em;
  font-weight: 500;
  color: var(--edt-fg-muted, #665c4d);
  text-align: left;
  transition: background var(--edt-dur-1);
}
.layer-row:hover { background: var(--edt-bg-hover, #ede5d2); }
.layer-row.active { color: var(--edt-fg, #2a241c); }
.layer-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
  opacity: 0.25;
  transition: opacity var(--edt-dur-1);
}
.layer-row.active .layer-swatch { opacity: 1; }

/* Map Key embedded inside the Layers panel. Hidden on desktop (the standalone
   bottom-left legend handles the key there); revealed on mobile so phones get
   one combined Layers + Key control. Reuses the .legend-row/.legend-shape/
   .legend-label/.legend-toggle styling. */
.layer-key-section { display: none; }
.layer-key-title {
  font-size: 0.7em;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--edt-fg-muted, #665c4d);
  margin: 4px 12px 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
}
.layer-key-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 12px;
}
.layer-key-section .legend-toggle { margin: 8px 12px 4px; }

/* =========================================================================
   Geocode search — top-left map control.
   ========================================================================= */
.geosearch-control { position: relative; }
.geosearch-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--edt-bg-elev-1, #fbf6ec);
  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.geosearch-icon { display: flex; color: var(--edt-fg-faint, #8a7e6a); flex-shrink: 0; }
.geosearch-input {
  width: 200px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.84em;
  color: var(--edt-fg, #2a241c);
}
.geosearch-input::placeholder { color: var(--edt-fg-faint, #8a7e6a); }
.geosearch-input-wrap:focus-within {
  border-color: var(--edt-accent, #246765);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), 0 0 0 2px color-mix(in srgb, var(--edt-accent, #246765) 15%, transparent);
}
.geosearch-results {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 280px;
  background: var(--edt-bg-elev-1, #fbf6ec);
  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
  overflow: hidden;
  z-index: var(--edt-z-map-control);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.geosearch-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.geosearch-result:last-child { border-bottom: none; }
.geosearch-result:hover { background: var(--edt-bg-hover, #ede5d2); }
.gs-label {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  cursor: pointer;
}
.gs-name { font-size: 0.84em; font-weight: 600; color: var(--edt-fg, #2a241c); }
.gs-detail { font-size: 0.75em; color: var(--edt-fg-muted, #665c4d); margin-top: 1px; }
.gs-add {
  flex: 0 0 auto;
  font-size: 0.72em;
  font-weight: 600;
  color: var(--edt-accent, #246765);
  background: var(--edt-bg-elev-1, #fbf6ec);
  border: 1px solid rgba(37, 99, 235, 0.4);
  border-radius: 6px;
  padding: 3px 7px;
  cursor: pointer;
  white-space: nowrap;
}
.gs-add:hover { background: rgba(37, 99, 235, 0.08); }
.gs-add:focus-visible { outline: 2px solid rgba(37, 99, 235, 0.5); outline-offset: 1px; }
.geosearch-none { padding: 8px 12px; font-size: 0.82em; color: var(--edt-fg-muted, #665c4d); }
.geosearch-error {
  padding: 8px 12px;
  font-size: 0.82em;
  color: var(--edt-danger, #a23c28);
  background: var(--edt-danger-soft, #f5dcd2);
  border-top: 1px solid rgba(179, 38, 30, 0.18);
}
.place-duplicate-warning[hidden] {
  display: none;
}
.place-duplicate-warning {
  padding: 10px 12px;
  border: 1px solid var(--edt-warning-border);
  border-radius: 8px;
  background: var(--edt-warning-soft, #f2e4c4);
  color: var(--edt-warning, #8a5a14);
  font-size: 0.84em;
}
.place-duplicate-title {
  font-weight: 800;
}
.place-duplicate-list {
  list-style: none;
  margin: 7px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.place-duplicate-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.place-duplicate-list strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.place-duplicate-list span {
  flex: none;
  color: var(--edt-warning, #8a5a14);
}
.place-duplicate-note {
  margin-top: 7px;
  color: var(--edt-warning, #8a5a14);
}
.place-geocode-field {
  position: relative;
}
.place-geocode-slot .geosearch-control {
  width: 100%;
}
.entity-form .place-geocode-control .geosearch-input-wrap {
  width: 100%;
  box-sizing: border-box;
  box-shadow: none;
  background: var(--edt-bg-elev-1, #fbf6ec);
  border-color: var(--edt-control-border, #94875f);
}
.entity-form .place-geocode-control .geosearch-input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  font-size: 1em;
}
.entity-form .place-geocode-control .geosearch-input:focus {
  border: 0;
  box-shadow: none;
  background: transparent;
}
.place-geocode-control .geosearch-results {
  width: 100%;
  max-height: 260px;
  overflow-y: auto;
  z-index: var(--edt-z-dropdown);
}
.place-location-status {
  min-height: 1.2em;
  font-size: 0.78em;
  color: var(--edt-fg-muted, #665c4d);
  font-weight: 500;
}
.pending-place-marker {
  filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0.9)) drop-shadow(0 4px 10px rgba(17, 24, 39, 0.35));
}

/* =========================================================================
   Legend (map key) — bottom-left collapsible map control.
   ========================================================================= */
.legend-panel {
  background: var(--edt-bg-elev-1, #fbf6ec);
  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}
.legend-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 12px;
  background: none;
  border: none;
  font-size: 0.85em;
  font-weight: 600;
  color: var(--edt-fg-muted, #665c4d);
  cursor: pointer;
  text-align: left;
}
.legend-trigger:hover { background: var(--edt-bg-hover, #ede5d2); }
.legend-trigger-icon { display: block; flex-shrink: 0; }
.legend-body {
  display: none;
  padding: 4px 12px 10px;
  min-width: 160px;
}
.legend-panel.open .legend-body { display: block; }
.legend-panel.open .legend-trigger { border-bottom: 1px solid rgba(0, 0, 0, 0.07); }

.legend-title {
  font-size: 0.7em;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--edt-fg-muted, #665c4d);
  margin: 6px 0 6px;
}
.legend-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85em;
  color: var(--edt-fg, #2a241c);
  line-height: 1;
  padding: 3px 0;
}
.legend-shape {
  flex: 0 0 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* Strip the heavy drop-shadow halo on clipped shapes inside the legend —
   the map context provides the contrast, the white panel doesn't need it. */
.legend-shape .place-marker.type-park,
.legend-shape .place-marker.type-transit,
.legend-shape .place-marker.type-lodging,
.legend-shape .place-marker.type-special { filter: none; }

.legend-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  font-size: 0.78em;
  color: var(--edt-fg-muted, #665c4d);
  cursor: pointer;
  user-select: none;
}
.legend-toggle input { margin: 0; cursor: pointer; }
/* Hover tooltip that follows the cursor over overlay polygons and path lines.
   One absolutely-positioned div lives inside the map container; the map shell writes
   text into it and toggles the tier modifier class. Pointer-events: none so
   the tooltip never eats clicks or context menus aimed at the map. */
.map-hover-tip {
  position: absolute;
  z-index: var(--edt-z-tooltip);
  pointer-events: none;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.85em;
  color: var(--edt-fg, #2a241c);
  padding: 6px 10px;
  max-width: 280px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
}
.map-hover-tip .hover-verb {
  flex: none;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--edt-accent-soft, #dbeceb);
  color: var(--edt-accent-strong, #1f5251);
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}
.map-hover-tip .hover-subject {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* This 4-color set distinguishes hierarchy levels (Locale/Area/Region/Jurisdiction),
   not app semantics — two of the four happen to numerically match --edt-accent/
   --edt-success, but tokenizing only those two would make the legend inconsistent
   across themes (2 shifting with light-dark(), 2 fixed). Left as a single
   deliberate, cohesive exception; no EdT token models a hierarchy-level palette. */
.map-hover-tip.locale-tip       { border-color: rgba(34, 102, 204, 0.35); }
.map-hover-tip.area-tip         { border-color: rgba(204, 119, 34, 0.35); }
.map-hover-tip.region-tip       { border-color: rgba(122, 45, 138, 0.35); }
.map-hover-tip.jurisdiction-tip { border-color: rgba(6, 95, 70, 0.35); }

.control-help-description {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.control-help-tooltip {
  position: fixed;
  z-index: var(--edt-z-tooltip);
  max-width: 240px;
  padding: 6px 9px;
  border-radius: 7px;
  background: rgba(17, 24, 39, 0.95);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  font-size: 12px;
  line-height: 1.35;
  pointer-events: none;
}

.control-help-tooltip[hidden] { display: none; }

/* Permanent overlay labels are WebGL symbol layers — label color + halo
   are paint properties on the kokoroad-<tier>-label symbol layer in
   app/javascript/map_shell.js, not CSS. */

.place-marker {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--type-dot, #246765);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
}

/* The MapLibre anchor is the 44px native button. The visual marker remains
   18px and lives inside it, so hit-target sizing never overrides MapLibre's
   inline positioning transform or the category shape transforms. */
.marker-hit-target {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  z-index: 0;
}
.marker-hit-target.maplibregl-marker { position: absolute; }
.marker-hit-target:hover { z-index: 1; }
.marker-hit-target[aria-current="true"] { z-index: 2; }
.marker-hit-target.editing { z-index: 3; }
.marker-hit-target:focus-visible {
  outline: 3px solid var(--edt-accent, #246765);
  outline-offset: 1px;
}
.marker-hit-target .marker-visual { flex: 0 0 auto; }

/* Marquee badge — small gold star at the upper-right corner of the marker,
   overflowing outside the 18×18 icon box. Sits on top of every shape via
   z-index. For clipped shapes (Park/Transit/Special) the host .place-marker
   itself isn't clipped (clip-path is on ::before/::after), so a child span
   here is unaffected. */
.place-marker .marquee-star {
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 12px;
  line-height: 12px;
  color: var(--edt-warning, #8a5a14);
  text-shadow: 0 0 1px #fff, 0 0 2px #fff, 0 1px 1px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 3;
}
/* Diamond rotates the host 45°; counter-rotate the star so it stays upright. */
.place-marker.type-entertainment .marquee-star { transform: rotate(-45deg); }
/* Shape variants only — fill color comes from var(--type-dot) above.
   Similar types share shapes for map cohesion (e.g. Cafe + Restaurant
   both circles; Landmark + Attraction both rounded squares).

   Rounded square: Landmark, Attraction
   Circle (default): Cafe, Restaurant
   Diamond: Entertainment
   Coin (circle + slot): Store
   Triangle: Park
   Upside-Down Triangle: Transit
   House: Lodging
   Star: Special
   Ring: Grapevine
*/
.place-marker.type-landmark,
.place-marker.type-attraction { border-radius: 4px; }

.place-marker.type-entertainment {
  transform: rotate(45deg);
  border-radius: 2px;
}

/* Coin: circle + vertical slot (Mario coin), via pseudo-element. The base
   .place-marker rule already provides `position: relative` for the legend,
   and on the map MapLibre's `.maplibregl-marker { position: absolute }`
   wins by cascade — see the comment above the type-park/transit/special
   rule for why a more-specific `position: relative` here would break the
   map render. */
.place-marker.type-store::after {
  content: "";
  position: absolute;
  top: 3px; bottom: 3px;
  left: 50%;
  width: 2px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 1px;
  transform: translateX(-50%);
  pointer-events: none;
}

/* Grapevine: a hollow ring — an outline for a place we've only heard of and
   haven't filled in yet. Inherited from Lodging, which moved to the House
   shape when Grapevine claimed the ring. */
.place-marker.type-grapevine {
  background: transparent;
  border: 4px solid var(--type-dot, #246765);
  box-shadow:
    0 0 0 2px #fff,
    0 2px 6px rgba(0, 0, 0, 0.25);
}

/* Clipped shapes (Triangle/Plus/Star): clip-path strips border + box-shadow,
   so we build the marker from two stacked pseudo-elements — ::before is a
   slightly oversized white shape (the "halo"/border), ::after is the
   colored fill at native size. Both share the same clip-path. The host
   keeps the drop-shadow for the soft ground shadow.
   Editing-state ring is overridden below by recolouring ::before. */
/* No `position` or `transform` declarations here on purpose. Base
   `.place-marker { position: relative }` still applies in the legend /
   panel previews where the ::before/::after halo + marquee star anchor
   relative to this element. On the map, MapLibre adds `.maplibregl-marker`
   to the same element, whose `position: absolute` rule has equal
   specificity to `.place-marker` and wins by cascade order (maplibre-gl.css
   is loaded after this file). A more-specific override here — the previous
   `.place-marker.type-park { position: relative }` — beat both
   `.place-marker` AND `.maplibregl-marker` by specificity, leaving the
   marker in document flow under MapLibre and stacking shape-by-shape down
   the page (which is how the "marquee pins drift south" bug manifested).
   Same reason `transform: none` was removed: MapLibre writes its
   anchor + position transform inline, so any CSS-side `transform` value on
   these elements is either a no-op (inline wins) or a footgun. */
.place-marker.type-park,
.place-marker.type-transit,
.place-marker.type-lodging,
.place-marker.type-special {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}
.place-marker.type-park::before,
.place-marker.type-park::after,
.place-marker.type-transit::before,
.place-marker.type-transit::after,
.place-marker.type-lodging::before,
.place-marker.type-lodging::after,
.place-marker.type-special::before,
.place-marker.type-special::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
/* ::after = colored fill at native 18×18. ::before = white halo.
   Halo inset is per-type because pointy shapes (Star) and shapes with
   concave notches (Plus) don't get a uniform 3px halo from simple
   scaling, so they get a custom halo polygon and/or bigger inset. */
.place-marker.type-park::after,
.place-marker.type-transit::after,
.place-marker.type-lodging::after,
.place-marker.type-special::after {
  inset: 0;
  background: var(--type-dot, #246765);
}
.place-marker.type-park::before,
.place-marker.type-transit::before,
.place-marker.type-lodging::before,
.place-marker.type-special::before {
  background: #fff;
}

/* ── Park: rounded equilateral triangle with uniform 3px white border.
   Polygon clip-path can't round corners, and a scaled-polygon halo
   doesn't stay 3px on every edge (because the triangle isn't centered
   in its bbox — scaling shifts the centroid). Solution: clip-path:
   path() with hand-computed pixel coords. Halo path lives in a 28×28
   element (inset:-5) and is the inner triangle offset 3px outward on
   every side; ~2px corner radius on the halo, subtler on the fill. */
.place-marker.type-park::before {
  inset: -5px;
  clip-path: path("M 15.65 4.02 L 25.82 21.71 Q 27.47 24.56 23.82 24.56 L 4.18 24.56 Q 0.53 24.56 2.18 21.71 L 12.35 4.02 Q 14 1.16 15.65 4.02 Z");
}
.place-marker.type-park::after {
  clip-path: path("M 10.29 4.41 L 15.99 14.31 Q 17.28 16.56 14.68 16.56 L 3.32 16.56 Q 0.72 16.56 2.02 14.31 L 7.71 4.41 Q 9 2.16 10.29 4.41 Z");
}

/* ── Transit (Upside-Down Triangle): mirror of Park about the horizontal
   axis (Y-flipped clip-path coords). Same 18×18 inner box + 28×28 halo
   (inset:-5) with ~2px halo corner radius — see the Park comment above for
   why this uses clip-path: path() rather than polygon. */
.place-marker.type-transit::before {
  inset: -5px;
  clip-path: path("M 15.65 23.98 L 25.82 6.29 Q 27.47 3.44 23.82 3.44 L 4.18 3.44 Q 0.53 3.44 2.18 6.29 L 12.35 23.98 Q 14 26.84 15.65 23.98 Z");
}
.place-marker.type-transit::after {
  clip-path: path("M 10.29 13.59 L 15.99 3.69 Q 17.28 1.44 14.68 1.44 L 3.32 1.44 Q 0.72 1.44 2.02 3.69 L 7.71 13.59 Q 9 15.84 10.29 13.59 Z");
}

/* ── Lodging (House): pitched roof over a square body. Unlike Park/Transit
   this uses a plain polygon for both halo and fill — the outline is convex
   with no fine spikes, so scaling it out by a 4px inset keeps the border
   close enough to uniform (same approach as Special below). */
.place-marker.type-lodging::before { inset: -4px; }
.place-marker.type-lodging::before,
.place-marker.type-lodging::after {
  clip-path: polygon(50% 0%, 100% 42%, 100% 100%, 0% 100%, 0% 42%);
}

/* ── Special (Star): pointy spikes pinch the halo geometrically; bump
   inset to -5px to give the visible border more weight. */
.place-marker.type-special::before { inset: -5px; }
.place-marker.type-special::before,
.place-marker.type-special::after {
  clip-path: polygon(
    50% 2%, 61% 35%, 96% 35%, 68% 57%, 79% 92%,
    50% 71%, 21% 92%, 32% 57%, 4% 35%, 39% 35%
  );
}

/* Skip It: red circle with diagonal bar — uniform "cancel" look regardless
   of underlying type. Forces every shape-driving property back to the
   circle treatment and suppresses the clipped-shape halo (::before). */
.place-marker.skip-it {
  background: var(--edt-danger, #a23c28) !important;
  border: 3px solid #fff !important;
  border-radius: 50% !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25) !important;
  filter: none !important;
  overflow: hidden;
  /* NO `transform` or `position` here — both are footguns on the map marker
     (see the type-park/transit/special comment above). `transform: none
     !important` overrode MapLibre's inline positioning transform and a
     more-specific `position: relative` beat `.maplibregl-marker { position:
     absolute }`, together snapping every Skip-It marker to the map's
     top-left corner. border-radius:50% already forces a circle, so the
     diamond rotation we'd be resetting is invisible anyway. The ::after bar
     anchors fine to whichever positioning context the host inherits
     (relative in the legend/panel, absolute on the map). */
}
.place-marker.skip-it::before { display: none; }
.place-marker.skip-it::after {
  content: "";
  position: absolute;
  top: 50%;
  bottom: auto;     /* clear inset:0 inherited from clipped-shape ::after */
  left: -4px;
  right: -4px;
  width: auto;
  height: 2.5px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 1px;
  transform: translateY(-50%) rotate(-45deg);
  clip-path: none;  /* clear any per-type clip-path */
  -webkit-mask: none;
          mask: none;  /* defensive: clear any per-type SVG mask (no current type uses one — Transit was moved to clip-path) */
}

/* Edit highlight: teal accent ring + soft pulse so the place currently
   open in the edit form is unambiguous on the map. */
.place-marker.editing {
  box-shadow:
    0 0 0 4px rgba(47, 122, 120, 0.95),
    0 0 12px 6px rgba(47, 122, 120, 0.45),
    0 2px 6px rgba(0, 0, 0, 0.3);
  animation: place-marker-edit-pulse 1.6s ease-in-out infinite;
}
/* Clipped shapes use a halo pseudo-element instead of box-shadow, so
   editing-state recolours that halo to teal. The element size is NOT
   bumped here — clip-path: path() (Park, Transit) expects a specific
   element size; resizing would clip the halo. Extra emphasis comes from
   the host's drop-shadow filter glow (below). Pulse animation still
   applies. */
.place-marker.type-park.editing::before,
.place-marker.type-transit.editing::before,
.place-marker.type-lodging.editing::before,
.place-marker.type-special.editing::before {
  background: rgba(47, 122, 120, 0.95);
}
.place-marker.type-park.editing,
.place-marker.type-transit.editing,
.place-marker.type-lodging.editing,
.place-marker.type-special.editing {
  box-shadow: none;
  filter:
    drop-shadow(0 0 4px rgba(47, 122, 120, 0.55))
    drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}
@keyframes place-marker-edit-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.78; }
}

/* Type chip — used in views, browse list, popups */
.type-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78em;
  font-weight: 600;
  color: #fff;
  line-height: 1.4;
  white-space: nowrap;
}
/* Per-type chip background lives in map-browse.css (uses
   var(--type-soft) / var(--type-ink) from the shared .type-X palette). */

/* =========================================================================
   Side panels (shared structure)
   ========================================================================= */
#sidePanel {
  position: fixed;
  top: 0;
  height: 100vh;
  background: var(--edt-bg-elev-1, #fbf6ec);
  transition: transform 0.25s ease, width 0.25s ease;
  z-index: var(--edt-z-panel);
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--edt-fg, #2a241c);
  --side-panel-width: 400px;
}
#sidePanel header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--edt-line, #e3dac4);
  flex: 0 0 auto;
  position: relative;
}
#sidePanel .panel-title { font-weight: 600; font-size: 1.05em; }
#sidePanel .panel-body { overflow-y: auto; flex: 1 1 auto; }

#sidePanel .panel-handle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 56px;
  background: var(--edt-bg-elev-1, #fbf6ec);
  border: 1px solid rgba(0, 0, 0, 0.08);
  cursor: pointer;
  color: var(--edt-fg-muted, #665c4d);
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  z-index: var(--edt-z-panel);
  transition: color var(--edt-dur-1), background var(--edt-dur-1);
}
#sidePanel .panel-handle:hover { color: var(--edt-fg, #2a241c); background: var(--edt-bg-hover, #ede5d2); }
