/* ==========================================================================
   Peta Digital Desa Muncang — Ultra-Light Zen Atlas (v3)
   Zero backdrop-filter blur lag, zero SVG drop-shadow repaint lag,
   minimal HUD chrome, and 1-click Clean Map Mode.
   ========================================================================== */

:root {
  --canvas-light: #eae7df;
  --canvas-dark: #131a22;
  --surface: #ffffff;
  --surface-muted: #f3f2ee;
  --ink: #142b44;
  --ink-secondary: #44586e;
  --ink-muted: #5d7085;
  --border: rgba(20, 43, 68, 0.14);
  --border-strong: rgba(20, 43, 68, 0.24);

  --brand: #142b44;
  --brand-hover: #0d1f33;
  --accent: #c86d14;
  --accent-wash: #fdf2e6;
  --accent-ink: #8f4a07;

  --verified-bg: #e7f3f8;
  --verified-ink: #0f4c6e;
  --pending-bg: #fdf2e6;
  --pending-ink: #8f4a07;
  --danger: #b82534;
  --danger-bg: #fdf0f1;

  --shadow-float: 0 6px 20px rgba(20, 43, 68, 0.12), 0 1px 2px rgba(20, 43, 68, 0.08);
  --shadow-sm: 0 3px 10px rgba(20, 43, 68, 0.1), 0 1px 2px rgba(20, 43, 68, 0.06);
  --shadow-modal: 0 18px 44px rgba(13, 31, 51, 0.24);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-pill: 999px;

  --z-map: 1;
  --z-hud: 420;
  --z-top: 460;
  --z-sheet: 490;
  --z-toast: 550;
  --z-modal: 700;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font-sans: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  overflow-x: clip;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas-light);
  -webkit-font-smoothing: antialiased;
}

body.fonts-loading .stamp-name {
  opacity: 0;
}

body.fonts-ready .stamp-name {
  opacity: 1;
  transition: opacity 150ms ease-out;
}

button,
input {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 900;
  padding: 10px 14px;
  background: var(--brand);
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--r-sm);
}

.skip-link:focus {
  top: 16px;
}

/* ==========================================================================
   Map Stage (Zero expensive filters or continuous blur)
   ========================================================================== */

.atlas-stage {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--canvas-light);
}

.map-canvas {
  position: relative;
  z-index: var(--z-map);
  width: 100%;
  height: 100%;
  background-color: var(--canvas-light);
}

.atlas-stage.is-satellite .map-canvas {
  background-color: var(--canvas-dark);
}

/* Clean Mode / Zen Mode transitions (compositor-only opacity + transform) */
.hud-chrome {
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.atlas-stage.is-zen .hud-chrome {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
}

.atlas-stage.is-zen .controls-dock,
.atlas-stage.is-zen .atlas-stamp {
  transform: translateY(10px);
}

/* Contour Self-Draw Animation (runs once on load, zero ongoing cost) */
.muncang-boundary-line.animate-draw {
  animation: draw-contour 850ms var(--ease-out) forwards;
}

@keyframes draw-contour {
  to {
    stroke-dashoffset: 0;
  }
}

/* Loading Pill */
.loading-veil {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: var(--z-toast);
  pointer-events: none;
  transition: opacity 180ms ease-out;
}

.loading-veil.is-hidden {
  opacity: 0;
}

.loading-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-float);
  font-size: 13px;
  font-weight: 600;
}

.loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 1s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(0.8); opacity: 0.45; }
  50% { transform: scale(1.2); opacity: 1; }
}

/* ==========================================================================
   Top-Left Minimal Command Island
   ========================================================================== */

.top-left-hud {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: 14px;
  z-index: var(--z-top);
  width: 332px;
  max-width: calc(100% - 168px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.command-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-float);
  min-width: 0;
}

.command-bar:focus-within {
  border-color: var(--brand);
}

.icon-action-btn {
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink);
  display: grid;
  place-items: center;
  transition: background-color 140ms ease-out;
}

.icon-action-btn:hover {
  background: var(--surface-muted);
}

.icon-action-btn.is-active {
  background: var(--accent-wash);
  color: var(--accent-ink);
}

.filter-dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.filter-dot[hidden] {
  display: none;
}

.command-input-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
}

.command-input {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 32px 0 4px;
  border: 0;
  background: transparent;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}

.command-input::placeholder {
  color: var(--ink-muted);
  font-weight: 400;
}

.command-input:focus {
  outline: none;
}

.command-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.clear-input-btn {
  position: absolute;
  right: 0;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-secondary);
  display: grid;
  place-items: center;
}

.clear-input-btn:hover {
  background: var(--surface-muted);
}

.clear-input-btn[hidden] {
  display: none;
}

.count-btn {
  flex: 0 0 auto;
  min-width: 44px;
  height: 44px;
  padding: 0 11px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--brand);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: grid;
  place-items: center;
  transition: background-color 140ms ease-out;
}

.count-btn:hover {
  background: var(--brand-hover);
}

.count-btn.is-open {
  background: var(--accent);
}

/* Active Category Filter Pill (only shown when filtering) */
.active-filter-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 5px 10px 5px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-sm);
  font-size: 12px;
}

.active-filter-row[hidden] {
  display: none;
}

.active-filter-chip {
  font-weight: 700;
  color: var(--ink);
}

.active-filter-clear {
  border: 0;
  background: var(--surface-muted);
  color: var(--ink-secondary);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--r-pill);
}

.active-filter-clear:hover {
  color: var(--ink);
}

/* Error Banner */
.floating-error {
  padding: 10px 12px;
  background: var(--danger-bg);
  border: 1px solid rgba(184, 37, 52, 0.3);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.floating-error[hidden] {
  display: none;
}

.floating-error p {
  margin: 0;
  font-size: 12.5px;
  color: var(--danger);
  font-weight: 500;
}

/* Shared Popover Panel (Filter & Directory) */
.popover-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-float);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: pop-in 160ms var(--ease-out);
}

.popover-panel[hidden] {
  display: none;
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 10px 10px 14px;
  border-bottom: 1px solid var(--border);
}

.popover-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}

.popover-sub {
  display: block;
  font-size: 11.5px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.mini-text-btn {
  min-height: 36px;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
}

.mini-text-btn:hover {
  background: var(--accent-wash);
}

.icon-close-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-secondary);
  display: grid;
  place-items: center;
}

.icon-close-btn:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

/* Compact 2-Column Category Filter Grid */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 10px 12px;
}

.filter-opt {
  min-height: 44px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
  text-align: left;
  transition: background-color 120ms ease-out, border-color 120ms ease-out;
}

.filter-opt:hover {
  background: var(--surface-muted);
}

.filter-opt.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.filter-opt-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.filter-opt.is-active .filter-opt-dot {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.filter-opt-label {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-opt-count {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.popover-toggles {
  border-top: 1px solid var(--border);
  padding: 8px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface-muted);
}

.inline-toggle {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.inline-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
  cursor: pointer;
}

/* Directory Drawer List */
.directory-panel {
  max-height: min(56dvh, 430px);
}

.drawer-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.drawer-item + .drawer-item {
  margin-top: 2px;
}

.drawer-item-btn {
  width: 100%;
  min-height: 54px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-item-btn:hover {
  background: var(--surface-muted);
}

.drawer-item-btn.is-selected {
  background: var(--accent-wash);
}

.drawer-item-icon {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  color: #ffffff;
  display: grid;
  place-items: center;
}

.drawer-item-icon svg {
  width: 16px;
  height: 16px;
}

.drawer-item-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  flex: 1 1 auto;
}

.drawer-item-name {
  display: block;
  width: 100%;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-item-sub {
  display: block;
  width: 100%;
  font-size: 11.5px;
  color: var(--ink-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-empty {
  padding: 24px 16px;
  text-align: center;
}

.drawer-empty[hidden] {
  display: none;
}

.drawer-empty-title {
  margin: 0 0 4px;
  font-size: 13.5px;
  font-weight: 700;
}

.drawer-empty-desc {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--ink-secondary);
}

/* ==========================================================================
   Top-Right Clean Map / Zen Toggle
   ========================================================================== */

.top-right-zen {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  z-index: var(--z-top);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.zen-toggle-btn {
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background-color 140ms ease-out, color 140ms ease-out;
}

.zen-toggle-btn:hover {
  background: var(--surface-muted);
}

.zen-icon-show {
  display: none;
}

.zen-toggle-btn.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.zen-toggle-btn.is-active .zen-icon-hide {
  display: none;
}

.zen-toggle-btn.is-active .zen-icon-show {
  display: block;
}

.zen-sub-btn {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  font-weight: 600;
}

.zen-sub-btn[hidden] {
  display: none;
}

/* ==========================================================================
   Bottom-Left Quiet Territorial Label & Bottom-Right Mini Dock
   ========================================================================== */

.atlas-stamp {
  position: absolute;
  left: 14px;
  bottom: 16px;
  z-index: var(--z-hud);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-sm);
  font-size: 12px;
}

.stamp-name {
  font-weight: 800;
  color: var(--ink);
}

.stamp-metric {
  font-weight: 600;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
}

.stamp-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--border-strong);
}

.stamp-info-btn {
  border: 0;
  background: transparent;
  padding: 2px 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-ink);
}

.stamp-info-btn:hover {
  text-decoration: underline;
}

.controls-dock {
  position: absolute;
  right: 14px;
  bottom: 24px;
  z-index: var(--z-hud);
  display: flex;
  align-items: center;
  gap: 8px;
}

.basemap-pill {
  display: inline-flex;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}

.basemap-seg {
  min-height: 38px;
  padding: 0 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 700;
}

.basemap-seg.is-active {
  background: var(--brand);
  color: #ffffff;
}

.mini-tool-bar {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.tool-btn {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--ink);
  display: grid;
  place-items: center;
}

.tool-btn + .tool-btn {
  border-left: 1px solid var(--border);
}

.tool-btn:hover {
  background: var(--surface-muted);
  color: var(--accent);
}

/* ==========================================================================
   Floating Location Detail Card
   ========================================================================== */

.detail-sheet {
  position: absolute;
  left: 14px;
  bottom: 16px;
  z-index: var(--z-sheet);
  width: 356px;
  max-width: calc(100% - 28px);
  max-height: calc(100dvh - 96px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: sheet-in 200ms var(--ease-out);
}

.detail-sheet[hidden] {
  display: none;
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.sheet-drag-bar {
  display: none;
}

.detail-sheet-inner {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.detail-hero {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-muted);
}

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

.detail-scene {
  width: 100%;
  height: 100%;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
}

.detail-scene-art {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
}

.detail-scene-badge {
  position: relative;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}

.detail-scene-badge svg {
  width: 20px;
  height: 20px;
}

.detail-scene-caption {
  position: relative;
  z-index: 2;
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
}

.detail-close-fab {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--r-pill);
  background: rgba(20, 43, 68, 0.76);
  color: #ffffff;
  display: grid;
  place-items: center;
}

.detail-close-fab:hover {
  background: var(--brand);
}

.detail-body {
  padding: 14px 16px 16px;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tag-cat {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #ffffff;
}

.tag-status {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
}

.tag-status.is-verified {
  background: var(--verified-bg);
  color: var(--verified-ink);
}

.tag-status.is-pending {
  background: var(--pending-bg);
  color: var(--pending-ink);
}

.detail-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.25;
}

.detail-subcat {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--ink-secondary);
}

.detail-desc {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.55;
}

.detail-meta {
  margin: 12px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 7px;
}

.detail-meta-item {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 8px;
  font-size: 12.5px;
}

.detail-meta-item dt {
  color: var(--ink-muted);
  font-weight: 600;
}

.detail-meta-item dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.detail-meta-item dd.is-tabular {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.detail-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 14px;
}

.btn-primary,
.btn-outline {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
}

.btn-primary {
  background: var(--brand);
  color: #ffffff;
  border: 1px solid var(--brand);
}

.btn-primary:hover {
  background: var(--brand-hover);
}

.btn-outline {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
}

.btn-outline:hover {
  background: var(--surface-muted);
}

.btn-xs {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 12px;
}

/* ==========================================================================
   Featherweight Custom Teardrop Map Pins (Zero CSS filter lag!)
   ========================================================================== */

.muncang-pin-wrap {
  background: transparent;
  border: 0;
}

.pin-anchor {
  position: relative;
  width: 34px;
  height: 42px;
  display: block;
  transform-origin: 50% 94%;
  transition: transform 160ms var(--ease-out);
}

.pin-shape {
  position: relative;
  z-index: 1 !important;
  display: block;
}

.atlas-stage.is-zoomed-out .pin-anchor {
  transform: scale(0.86);
}

.pin-anchor:hover {
  transform: translateY(-4px) scale(1.06);
}

.pin-anchor.is-selected {
  transform: translateY(-5px) scale(1.14);
}

.pin-glyph {
  position: absolute;
  top: 7px;
  left: 50%;
  z-index: 210;
  transform: translateX(-50%);
  width: 17px;
  height: 17px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.pin-glyph svg {
  width: 16px;
  height: 16px;
  display: block;
  z-index: 211 !important;
}

/* Scale-Dependent Cartographic Label (hidden at low zoom, crisp halo at zoom >= 16 or filtered) */
.pin-label {
  position: absolute;
  top: 41px;
  left: 50%;
  z-index: 215;
  transform: translateX(-50%);
  width: max-content;
  max-width: 148px;
  padding: 1px 4px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  color: var(--ink);
  text-shadow:
    0 0 3px #ffffff,
    0 0 5px #ffffff,
    1px 1px 0 #ffffff,
    -1px -1px 0 #ffffff,
    1px -1px 0 #ffffff,
    -1px 1px 0 #ffffff;
  white-space: normal;
  overflow-wrap: break-word;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 160ms var(--ease-out);
}

.atlas-stage.is-satellite .pin-label {
  color: #ffffff;
  text-shadow:
    0 1px 3px rgba(13, 22, 33, 0.95),
    0 0 6px rgba(13, 22, 33, 0.95),
    1px 1px 0 rgba(13, 22, 33, 0.9),
    -1px -1px 0 rgba(13, 22, 33, 0.9);
}

.atlas-stage.show-pin-labels .pin-label,
.pin-anchor.is-selected .pin-label {
  opacity: 1;
  visibility: visible;
}

/* Avoid duplicate hover tooltip when permanent labels are already shown */
.atlas-stage.show-pin-labels .leaflet-tooltip.muncang-tooltip {
  display: none;
}

.pin-sonar {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  border: 2px solid var(--pin-color, #142b44);
  opacity: 0;
  pointer-events: none;
}

.pin-anchor.is-selected .pin-sonar {
  animation: sonar-ring 1.6s var(--ease-out) infinite;
}

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

.leaflet-tooltip.muncang-tooltip {
  background: var(--brand);
  color: #ffffff;
  border: 0;
  border-radius: 8px;
  padding: 5px 9px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.leaflet-tooltip.muncang-tooltip::before {
  border-top-color: var(--brand);
}

.leaflet-control-attribution {
  font-family: var(--font-sans) !important;
  font-size: 10px !important;
  background: rgba(255, 255, 255, 0.78) !important;
  color: var(--ink-secondary) !important;
}

/* ==========================================================================
   Toast & Modal
   ========================================================================== */

.toast-pill {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  max-width: calc(100% - 32px);
  padding: 9px 15px;
  background: var(--brand);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-modal);
  text-align: center;
}

.toast-pill[hidden] {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(13, 31, 51, 0.5);
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-backdrop[hidden] {
  display: none;
}

.info-modal {
  width: 100%;
  max-width: 450px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-modal);
  border: 1px solid var(--border);
}

.info-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 10px 12px 18px;
  border-bottom: 1px solid var(--border);
}

.info-modal-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.info-modal-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-secondary);
}

.info-modal-body {
  padding: 14px 18px 18px;
}

.info-modal-body p {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.6;
}

.info-list {
  margin: 0;
  border-top: 1px solid var(--border);
}

.info-list > div {
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.info-list dt {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-secondary);
}

.info-list dd {
  margin: 2px 0 0;
  font-size: 12.5px;
}

/* ==========================================================================
   Mobile Layout (< 680px) — Super Clean & Uncluttered
   ========================================================================== */

@media (max-width: 680px) {
  .top-left-hud {
    top: max(10px, env(safe-area-inset-top));
    left: 12px;
    width: calc(100% - 76px);
    max-width: calc(100% - 76px);
  }

  .top-right-zen {
    top: max(10px, env(safe-area-inset-top));
    right: 12px;
  }

  .zen-toggle-btn {
    padding: 0 12px;
  }

  /* Compact icon-only Clean Mode button on mobile when UI is open, expands with label in Zen Mode */
  .zen-toggle-btn:not(.is-active) #zenModeLabel {
    display: none;
  }

  .zen-toggle-btn:not(.is-active) {
    width: 44px;
    padding: 0;
    justify-content: center;
  }

  .desktop-only {
    display: none;
  }

  .atlas-stamp {
    left: 12px;
    bottom: calc(26px + env(safe-area-inset-bottom));
    padding: 0;
    border-radius: var(--r-md);
  }

  .stamp-name,
  .stamp-metric,
  .stamp-dot {
    display: none;
  }

  .stamp-info-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 0 12px;
    display: grid;
    place-items: center;
    font-size: 12.5px;
    color: var(--ink);
  }

  .controls-dock {
    right: 12px;
    bottom: calc(26px + env(safe-area-inset-bottom));
  }

  .basemap-seg {
    min-height: 44px;
    padding: 0 10px;
  }

  .detail-sheet {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: 82dvh;
    border-radius: 20px 20px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .sheet-drag-bar {
    display: flex;
    justify-content: center;
    padding: 8px 0 4px;
  }

  .sheet-drag-bar span {
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: var(--border-strong);
  }

  .detail-hero {
    aspect-ratio: 16 / 8;
  }

  .detail-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
