:root {
  color-scheme: light;
  --sky: #119ee9;
  --sky-deep: #087dca;
  --sky-soft: #dff6ff;
  --sun: #ffd54f;
  --sun-deep: #ffbf28;
  --ink: #17334a;
  --muted: #6c8496;
  --line: #e8f0f4;
  --map-height: 300px;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #dff5ff;
}

html {
  scroll-behavior: smooth;
}

body {
  color: var(--ink);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body.has-dialog {
  overflow: hidden;
}

::selection {
  background: #ffdc61;
  color: #17334a;
}

button {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-rows: auto var(--map-height) minmax(0, 1fr);
  width: 100%;
  max-width: 760px;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  margin: 0 auto;
  overflow: hidden;
  background: linear-gradient(180deg, #159feb 0 420px, #dff5ff 720px);
  box-shadow: 0 0 40px rgba(0, 104, 168, 0.12);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 80px;
  padding: calc(10px + env(safe-area-inset-top)) 18px 8px;
  background: transparent;
  color: #fff;
}

.brand-mark {
  display: grid;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  font-family: STKaiti, KaiTi, serif;
  font-size: 27px;
  font-weight: 800;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.1);
}

.title-group {
  min-width: 0;
}

.title-group h1,
.title-group p {
  margin: 0;
}

.title-group p {
  margin-bottom: 3px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  letter-spacing: 0.18em;
}

.title-group h1 {
  font-size: clamp(20px, 6vw, 28px);
  line-height: 1.15;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 8px rgba(0, 90, 150, 0.2);
}

.header-seal {
  display: grid;
  width: 50px;
  height: 50px;
  margin-left: auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 15px;
  background: rgba(3, 113, 184, 0.28);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  letter-spacing: 0.12em;
}

.map-section {
  min-height: 0;
  padding: 0 0 8px;
  background: transparent;
}

.map-viewer {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  touch-action: none;
  cursor: grab;
  user-select: none;
}

.map-viewer.is-dragging {
  cursor: grabbing;
}

.map-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 3509px;
  height: 2481px;
  transform-origin: 0 0;
  will-change: transform;
}

.map-stage.is-focusing {
  transition: transform 460ms cubic-bezier(0.22, 1, 0.36, 1);
}

.map-stage img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  -webkit-user-drag: none;
}

.district-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.marker-layer,
.map-guide {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.map-marker {
  --marker-color: #12b5e5;
  position: absolute;
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  transform: translate(-50%, -50%);
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
}

.map-marker[data-region="宝安区"] { --marker-color: #1ea4dd; }
.map-marker[data-region="光明区"] { --marker-color: #e61c6f; }
.map-marker[data-region="龙华区"] { --marker-color: #1c449b; }
.map-marker[data-region="龙岗区"] { --marker-color: #d9bc19; }
.map-marker[data-region="坪山区"] { --marker-color: #117739; }
.map-marker[data-region="南山区"] { --marker-color: #cf5a15; }
.map-marker[data-region="福田区"] { --marker-color: #6f8a30; }
.map-marker[data-region="罗湖区"] { --marker-color: #9b3123; }
.map-marker[data-region="盐田区"] { --marker-color: #97368f; }
.map-marker[data-region="大鹏新区"] { --marker-color: #e79213; }
.map-marker[data-region="深汕特别合作区"] { --marker-color: #5e8e33; }

.map-marker::before {
  content: "";
  position: absolute;
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.98);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 3px var(--marker-color);
  opacity: 0;
  transform: scale(0.72);
  transition: opacity 160ms ease, box-shadow 180ms ease, transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.map-marker::after {
  content: none;
}

.map-marker:hover::before,
.map-marker:focus-visible::before,
.map-marker.is-active::before {
  box-shadow: 0 0 0 3px var(--marker-color), 0 0 0 8px rgba(255, 255, 255, 0.76);
  opacity: 1;
  transform: scale(1);
}

.map-marker:focus-visible {
  outline: none;
}

.map-guide {
  z-index: 3;
  width: 270px;
  height: 280px;
  inset: auto;
  opacity: 0;
  transform: translate(-50%, -100%) scale(0.55);
  transform-origin: 50% 100%;
  filter: drop-shadow(0 24px 18px rgba(0, 63, 105, 0.25));
}

.map-guide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.map-guide.is-active {
  opacity: 1;
  animation: guide-arrive 660ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.district-layer path,
.district-layer polygon {
  fill: transparent;
  stroke: none;
  cursor: pointer;
  pointer-events: all;
  outline: none;
}

.district-layer.show-hotspots path,
.district-layer.show-hotspots polygon {
  fill: rgba(255, 148, 22, 0.2);
  stroke: #ff8b00;
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}

.district-layer [data-region]:focus,
.district-layer [data-region]:focus-visible {
  outline: none;
}

.loading-state,
.error-state {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  background: #e9f8ff;
  color: var(--muted);
  font-size: 13px;
}

.loading-state.is-hidden,
.error-state[hidden] {
  display: none;
}

.loading-line {
  width: min(180px, 48vw);
  height: 5px;
  overflow: hidden;
  border-radius: 5px;
  background: rgba(17, 158, 233, 0.14);
}

.loading-line::after {
  content: "";
  display: block;
  width: 45%;
  height: 100%;
  border-radius: inherit;
  background: var(--sky);
  animation: loading-slide 1.1s ease-in-out infinite alternate;
}

.error-state strong {
  color: var(--ink);
  font-size: 16px;
}

.gesture-tip {
  position: absolute;
  bottom: 14px;
  left: 14px;
  z-index: 2;
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(7, 86, 139, 0.82);
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
  transition: opacity 240ms ease;
}

.gesture-tip.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.places-panel {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: 0;
  margin: 0 14px calc(12px + env(safe-area-inset-bottom));
  overflow: hidden;
  flex-direction: column;
  border: 1px solid rgba(11, 124, 190, 0.08);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(0, 100, 162, 0.13);
}

.places-header {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 8px 14px;
  background: linear-gradient(135deg, var(--sun), var(--sun-deep));
  color: #17334a;
}

.current-label {
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: #426274;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.places-header strong {
  min-width: 0;
  overflow: hidden;
  font-size: clamp(16px, 4.5vw, 19px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.place-count {
  color: #654d00;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.places-empty {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px 20px;
  place-items: center;
  align-content: center;
  text-align: center;
}

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

.empty-marker {
  position: relative;
  width: 38px;
  height: 38px;
  margin-bottom: 12px;
  border: 8px solid #38a9ef;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 7px 14px rgba(17, 158, 233, 0.22);
}

.empty-marker::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
}

.places-empty strong {
  font-size: 17px;
}

.places-empty p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.places-list {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #9ddcff transparent;
  scrollbar-width: thin;
  list-style: none;
  -webkit-overflow-scrolling: touch;
}

.places-list[hidden] {
  display: none;
}

.places-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 12px;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.places-list li:last-child {
  border-bottom: 0;
}

.place-marker {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 3px solid #c9edff;
  border-radius: 50%;
  background: linear-gradient(145deg, #29b1f7, #0e88da);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 5px 10px rgba(5, 128, 204, 0.2);
}

.place-name {
  min-width: 0;
  overflow: hidden;
  color: #243f50;
  font-size: 14px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.place-chevron {
  width: 8px;
  height: 8px;
  transform: rotate(-45deg);
  border-right: 2px solid #8196a3;
  border-bottom: 2px solid #8196a3;
}

.places-list li {
  cursor: pointer;
  transition: background-color 160ms ease;
}

.places-list li:hover {
  background: #f4fbff;
}

.places-list li:focus-visible {
  outline: 3px solid rgba(17, 158, 233, 0.38);
  outline-offset: -3px;
}

.place-dialog {
  width: min(92vw, 560px);
  max-width: none;
  max-height: min(88dvh, 760px);
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--ink);
}

.place-dialog::backdrop {
  background: rgba(5, 44, 72, 0.68);
  backdrop-filter: blur(7px);
}

.place-dialog[open] {
  animation: dialog-enter 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.place-dialog:focus {
  outline: none;
}

.dialog-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: min(88dvh, 760px);
  max-height: min(88dvh, 760px);
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(0, 48, 80, 0.34);
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(4, 60, 96, 0.72);
  box-shadow: 0 7px 18px rgba(0, 43, 73, 0.2);
  cursor: pointer;
}

.dialog-close span {
  position: absolute;
  top: 20px;
  left: 11px;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: #fff;
}

.dialog-close span:first-child { transform: rotate(45deg); }
.dialog-close span:last-child { transform: rotate(-45deg); }

.dialog-close:focus-visible,
.carousel-button:focus-visible,
.carousel-dots button:focus-visible {
  outline: 3px solid #ffcf3f;
  outline-offset: 2px;
}

.carousel {
  position: relative;
  flex: 0 0 clamp(230px, 39vh, 340px);
  height: clamp(230px, 39vh, 340px);
  overflow: hidden;
  border-radius: 16px 16px 0 0;
  background: #128fda;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
}

.carousel.is-dragging {
  cursor: grabbing;
}

.carousel-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 380ms cubic-bezier(0.16, 1, 0.3, 1);
}

.carousel.is-dragging .carousel-track {
  transition: none;
}

.carousel-slide {
  position: relative;
  flex: 0 0 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

.carousel-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  -webkit-user-drag: none;
}

.carousel-counter {
  position: absolute;
  right: 16px;
  bottom: 15px;
  z-index: 3;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(4, 48, 78, 0.72);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.carousel-button {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 40px;
  height: 40px;
  margin-top: -20px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 7px 18px rgba(0, 51, 86, 0.16);
  cursor: pointer;
}

.carousel-button::before {
  content: "";
  position: absolute;
  top: 14px;
  width: 10px;
  height: 10px;
  transform: rotate(45deg);
}

.carousel-button.is-prev { left: 12px; }
.carousel-button.is-next { right: 12px; }
.carousel-button.is-prev::before { left: 16px; border-bottom: 2px solid var(--sky-deep); border-left: 2px solid var(--sky-deep); }
.carousel-button.is-next::before { right: 16px; border-top: 2px solid var(--sky-deep); border-right: 2px solid var(--sky-deep); }

.carousel-dots {
  position: absolute;
  bottom: 17px;
  left: 50%;
  z-index: 3;
  display: flex;
  max-width: calc(100% - 112px);
  gap: 7px;
  justify-content: center;
  transform: translateX(-50%);
}

.carousel-dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.54);
  cursor: pointer;
}

.carousel-dots button.is-active {
  width: 22px;
  border-radius: 8px;
  background: #fff;
}

.dialog-content {
  min-height: 0;
  padding: 24px 22px 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #9ddcff transparent;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.dialog-content h2 {
  margin: 0;
  color: #17334a;
  font-size: clamp(21px, 6vw, 28px);
  line-height: 1.3;
  text-wrap: balance;
}

.dialog-details {
  display: grid;
  gap: 0;
  margin: 0;
}

.dialog-details > div {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 12px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.dialog-details > div:last-child {
  border-bottom: 0;
}

.dialog-details dt,
.dialog-details dd {
  margin: 0;
  font-size: 14px;
  line-height: 1.75;
}

.dialog-details dt {
  color: var(--sky-deep);
  font-weight: 800;
}

.dialog-details dd {
  min-width: 0;
  color: #405e71;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.dialog-details dd.is-empty {
  color: #8096a5;
}

.dialog-details .is-introduction {
  grid-template-columns: 1fr;
  gap: 6px;
  padding-bottom: 2px;
}

.dialog-details .is-introduction dd {
  line-height: 1.85;
}

@keyframes loading-slide {
  from { transform: translateX(0); }
  to { transform: translateX(122%); }
}

@keyframes guide-arrive {
  0% { opacity: 0; transform: translate(-50%, -75%) scale(0.52); filter: blur(8px) drop-shadow(0 24px 18px rgba(0, 63, 105, 0)); }
  62% { opacity: 1; transform: translate(-50%, -108%) scale(1.04); filter: blur(0) drop-shadow(0 24px 18px rgba(0, 63, 105, 0.25)); }
  100% { opacity: 1; transform: translate(-50%, -100%) scale(1); }
}

@keyframes dialog-enter {
  from { opacity: 0; transform: translateY(34px) scale(0.96); filter: blur(6px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@media (min-width: 640px) {
  .topbar {
    padding-right: 28px;
    padding-left: 28px;
  }

  .map-section {
    padding-right: 0;
    padding-left: 0;
  }

  .places-panel {
    margin-right: 24px;
    margin-left: 24px;
  }

  .places-list li {
    padding-right: 24px;
    padding-left: 24px;
  }
}

@media (max-width: 380px) {
  .places-header {
    padding-right: 14px;
    padding-left: 14px;
  }

  .dialog-content {
    padding-right: 18px;
    padding-left: 18px;
  }

  .dialog-details > div {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 10px;
  }
}

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

  .map-guide.is-active,
  .place-dialog[open] {
    animation: none;
  }
}
