.map-dock {
  position: fixed;
  right: 20px;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  display: block;
  width: clamp(108px, 9vw, 144px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  font-size: clamp(11px, 0.55vw, 13px);
  text-decoration: none;
  color: #fff;
  transition: transform 0.16s ease;
}

.map-dock:hover {
  transform: scale(1.04);
}

.map-dock.has-pending {
  border-radius: 50%;
  animation: dockPendingPulse 2.4s ease-in-out infinite;
}

@keyframes dockPendingPulse {
  0%,
  100% {
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.12);
  }
  50% {
    box-shadow:
      0 0 0 5px color-mix(in srgb, var(--primary, #4f46e5) 22%, transparent),
      0 0 26px color-mix(in srgb, var(--primary, #4f46e5) 55%, transparent);
  }
}

.map-dock:focus-visible {
  outline: 2px solid var(--primary, #7b68ee);
  outline-offset: 4px;
}

.map-dock-mini,
.map-dock-tint,
.map-dock-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.map-dock-mini {
  overflow: hidden;
  clip-path: circle(50% at 50% 50%);
  border-radius: 50%;
  background: #c9d2cf;
}

.map-dock.is-guest .map-dock-mini {
  background-color: #eef1f5;
  background-image: url("/static/site/map-dock-guest-light.jpg");
  background-position: center;
  background-size: cover;
}

[data-theme="dark"] .map-dock.is-guest .map-dock-mini {
  filter: brightness(0.52) saturate(0.52) contrast(1.06);
}

.map-dock-tint {
  pointer-events: none;
  opacity: 0;
  background: rgba(18, 25, 35, 0.18);
}

[data-theme="dark"] .map-dock.is-guest .map-dock-tint {
  opacity: 1;
}

.map-dock-mini .leaflet-container,
.map-dock-mini .leaflet-pane,
.map-dock-mini .leaflet-tile {
  background: transparent;
}

.map-dock-mini .leaflet-control-container {
  display: none;
}

.map-dock-ring {
  pointer-events: none;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.85),
    inset 0 0 18px rgba(10, 14, 20, 0.35),
    0 8px 22px rgba(10, 14, 20, 0.35);
  border: 2px solid color-mix(in srgb, var(--primary, #7b68ee) 72%, #111);
}

.map-dock-cross {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1.3em;
  height: 1.3em;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.map-dock-cross::before,
.map-dock-cross::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 3px rgba(10, 14, 20, 0.8);
}

.map-dock-cross::before {
  left: 50%;
  top: 0;
  width: 2px;
  height: 100%;
  transform: translateX(-50%);
}

.map-dock-cross::after {
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  transform: translateY(-50%);
}

.map-dock-count {
  position: absolute;
  left: 50%;
  bottom: 0.38em;
  transform: translateX(-50%);
  min-width: 2.2em;
  padding: 0 0.65em;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  background: rgba(12, 16, 22, 0.72);
  color: #fff;
  font-size: 0.85em;
  font-weight: 800;
  line-height: 1.65em;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}

.map-dock-badge {
  position: absolute;
  top: 4%;
  right: 4%;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.7em;
  min-width: 1.7em;
  height: 1.7em;
  padding: 0 0.45em;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: var(--primary, #7b68ee);
  color: #fff;
  font-size: 0.85em;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  pointer-events: none;
  box-sizing: border-box;
}

.map-dock-badge[hidden] {
  display: none;
}

/* 地图入口上方的信息面板（与圆盘圆心左右对称、全透明） */
.dock-hud {
  position: fixed;
  right: calc(20px + clamp(108px, 9vw, 144px) / 2);
  bottom: calc(22px + env(safe-area-inset-bottom, 0px) + clamp(108px, 9vw, 144px) + 10px);
  z-index: 69;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  transform: translateX(50%);
  color: var(--muted);
  font-family: inherit;
  font-size: clamp(11px, 0.55vw, 13px);
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
}

.dock-hud-label {
  color: var(--primary, #4f46e5);
  font-weight: 400;
}

.dock-hud-value {
  color: var(--primary, #4f46e5);
  font-weight: 400;
}

.dock-hud-value[data-level="ok"] {
  color: var(--ok, #4caf7d);
}

.dock-hud-value[data-level="warn"] {
  color: var(--warn, #f2b544);
}

.dock-hud-value[data-level="bad"] {
  color: #d64545;
}

.dock-hud-value[data-level="deep"] {
  color: #2e6b4f;
}

[data-theme="dark"] .dock-hud-label,
[data-theme="dark"] .dock-hud-value {
  color: var(--accent, #818cf8);
}

[data-theme="dark"] .dock-hud-value[data-level="ok"] {
  color: var(--ok, #4ade80);
}

[data-theme="dark"] .dock-hud-value[data-level="warn"] {
  color: #fbbf24;
}

[data-theme="dark"] .dock-hud-value[data-level="bad"] {
  color: #f87171;
}

[data-theme="dark"] .dock-hud-value[data-level="deep"] {
  color: #4e9b74;
}

/* 大屏（2K / 4K）按比例放大，并向上、向内收一些 */
@media (min-width: 1600px) {
  .map-dock {
    right: 28px;
    bottom: calc(32px + env(safe-area-inset-bottom, 0px));
    width: clamp(144px, 8vw, 168px);
    font-size: 13px;
  }

  .dock-hud {
    right: calc(28px + clamp(144px, 8vw, 168px) / 2);
    bottom: calc(32px + env(safe-area-inset-bottom, 0px) + clamp(144px, 8vw, 168px) + 10px);
    font-size: 13px;
  }
}

@media (min-width: 2100px) {
  .map-dock {
    right: 40px;
    bottom: calc(44px + env(safe-area-inset-bottom, 0px));
    width: clamp(176px, 7.4vw, 200px);
    font-size: 15px;
  }

  .dock-hud {
    right: calc(40px + clamp(176px, 7.4vw, 200px) / 2);
    bottom: calc(44px + env(safe-area-inset-bottom, 0px) + clamp(176px, 7.4vw, 200px) + 10px);
    font-size: 15px;
  }
}

@media (min-width: 3000px) {
  .map-dock {
    right: 52px;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    width: 216px;
    font-size: 17px;
  }

  .dock-hud {
    right: calc(52px + 108px);
    bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 216px + 10px);
    font-size: 17px;
  }
}

@media (max-width: 640px) {
  .map-dock {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: 92px;
    font-size: 10px;
  }

  .dock-hud {
    right: calc(12px + 46px);
    bottom: calc(12px + env(safe-area-inset-bottom, 0px) + 92px + 8px);
    font-size: 10px;
  }

  .landing {
    padding-bottom: 118px;
  }
}

@media (max-width: 900px) {
  .dock-hud {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .map-dock {
    transition: none;
  }

  .map-dock.has-pending {
    animation: none;
  }
}

.dock-map-toast {
  position: fixed;
  right: 20px;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px) + clamp(108px, 9vw, 144px) + 42px);
  z-index: 71;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(26, 26, 34, 0.9);
  color: #fff;
  font-size: clamp(11px, 0.55vw, 13px);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.dock-map-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 640px) {
  .dock-map-toast {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px) + 92px + 30px);
    transform: translateY(6px);
    font-size: 10.5px;
  }

  .dock-map-toast.is-visible {
    transform: translateY(0);
  }
}

@media (min-width: 1600px) {
  .dock-map-toast {
    right: 28px;
    bottom: calc(32px + env(safe-area-inset-bottom, 0px) + clamp(144px, 8vw, 168px) + 42px);
  }
}

@media (min-width: 2100px) {
  .dock-map-toast {
    right: 40px;
    bottom: calc(44px + env(safe-area-inset-bottom, 0px) + clamp(176px, 7.4vw, 200px) + 42px);
  }
}
