/* 全局样式重置与基础设置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  height: 100vh;
  overflow: hidden;
  background-color: #f5f5f5;
  display: flex;
  justify-content: center;
  align-items: center;
  /* 防止浏览器误触发缩放手势的滚动放大 */
  touch-action: manipulation;
  line-height: 1.6;
}

button {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* 主容器 */
.main-container {
  width: 100%;
  max-width: 750px;
  height: 100vh;
  position: relative;
  background-color: white;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* 背景底图层 */
.background-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #c3eaf9 0%, #a8d5ea 100%);
  z-index: 1;
}

/* 顶部图片 */
.top-image {
  position: absolute;
  width: 100%;
  height: auto;
  top: 0;
  left: 0;
  z-index: 3;
  object-fit: cover;
}

/* 底部容器 */
.bottom-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 3;
  pointer-events: none;
  /* 允许点击穿透到地图 */
}

.bottom-container .bottom-image {
  position: absolute;
  width: 200px;
  height: auto;
  left: 0;
  bottom: -1px;
  object-fit: contain;
}

/* 交互式地图层 */
.map-container {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
}

#map {
  width: 100%;
  height: 100%;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

/* 自定义标点样式 */
.custom-marker {
  position: relative;
  width: 40px;
  height: 40px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

.custom-marker:hover {
  transform: scale(1.1);
  z-index: 2;
}

.custom-marker:active {
  transform: scale(0.95);
}

/* 标点图片 */
.marker-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 标点点击提示 */
.marker-click-hint {
  position: absolute;
  bottom: 33px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 18px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: clickHintPulse 1.8s ease-in-out infinite;
  backdrop-filter: blur(2px);
}

.marker-click-hint::before {
  content: "";
  display: block;
  width: 12px;
  height: 12px;
  background: url('../images/icon-click.png') no-repeat center;
  background-size: contain;
}

@keyframes clickHintPulse {

  0%,
  100% {
    opacity: 0.6;
    transform: translateX(-50%) scale(1);
  }

  50% {
    opacity: 1;
    transform: translateX(-50%) scale(1.2);
  }
}

/* 筛选标签层 */
.filter-tags {
  position: absolute;
  top: 20px;
  left: 10px;
  z-index: 4;
  display: flex;
  flex-direction: column;
}

/* 标签按钮 */
.tag-button {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 8px;
  padding: 4px;

  /* 移除移动端点击效果 */
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  outline: none;
  touch-action: manipulation;
}

.tag-button:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.tag-button:active {
  transform: translateY(0);
}

.tag-icon {
  width: 140px;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  transition: filter 0.3s ease;
}

.tag-button:hover .tag-icon {
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

/* 推荐线路按钮 */
.line-image {
  position: absolute;
  left: 50px;
  width: 90px;
  height: auto;
  bottom: 100px;
  z-index: 3;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  pointer-events: auto;
}

.line-image:hover {
  transform: translateY(-3px) scale(1.05);
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
}

.line-image:active {
  transform: translateY(-1px) scale(1.02);
}

/* Modal弹窗层 - 优化版本 */
.modal-overlay,
.modal-line-overlay {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 750px;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease-out;
}

.modal-overlay.show,
.modal-line-overlay.show {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* 详情弹窗内容 */
.modal-content {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  max-width: 420px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.9) translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.modal-overlay.show .modal-content {
  transform: scale(1) translateY(0);
}

/* 自定义滚动条 */
.modal-content::-webkit-scrollbar {
  width: 6px;
}

.modal-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.modal-content::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Modal头部 */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid #f5f5f5;
}

.modal-title {
  font-size: 20px;
  font-weight: 600;
  color: #2d3748;
  line-height: 1.2;
}

.close-button {
  background: #f7fafc;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #718096;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 300;
}

.close-button:hover {
  color: #4a5568;
  background: #edf2f7;
  transform: scale(1.05);
}

.close-button:active {
  transform: scale(0.95);
}

/* Modal主体内容 */
.modal-body {
  color: #4a5568;
  line-height: 1.6;
  font-size: 14px;
}

/* POI信息块 */
.poi-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(145deg, #f8f9fa, #e9ecef);
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  margin-bottom: 16px;
}

.poi-field {
  display: flex;
  align-items: center;
  gap: 12px;
}

.poi-label {
  color: #718096;
  font-size: 13px;
  font-weight: 500;
  min-width: 40px;
  flex-shrink: 0;
}

.poi-value {
  color: #2d3748;
  font-size: 14px;
  flex: 1;
  cursor: pointer;
  transition: color 0.2s ease;
}

.poi-value:hover {
  color: #3182ce;
}

.poi-summary {
  margin-top: 12px;
  color: #4a5568;
  font-size: 14px;
  line-height: 1.7;
  padding: 12px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  border-left: 3px solid #4ecdc4;
}

/* 链接按钮容器 */
.link-buttons {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  color: #ffffff;
  text-decoration: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.link-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.2);
  transition: left 0.3s ease;
}

.link-btn:hover::before {
  left: 0;
}

.link-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.link-btn:active {
  transform: translateY(0);
}

/* 按钮颜色主题 */
.link-btn:nth-child(1) {
  background: linear-gradient(135deg, #ff7a59, #ff6a43);
}

.link-btn:nth-child(2) {
  background: linear-gradient(135deg, #4ecdc4, #3bbab1);
}

.link-btn:nth-child(3) {
  background: linear-gradient(135deg, #5b8def, #4779e2);
}

.link-btn:nth-child(4) {
  background: linear-gradient(135deg, #48bb78, #38a169);
}

/* 推荐线路弹窗 */
.modal-line-content {
  padding: 16px 10px;
  background: linear-gradient(145deg, #ED9D2A 0%, #FFA08F 100%);
  border-radius: 20px;
  margin: 0 auto;
  width: 345px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  transform: scale(0.92) translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.modal-line-overlay.show .modal-line-content {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.modal-line-content .line-title {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.modal-line-content .line-title .line-title-image {
  width: 120px;
  height: auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.modal-line-content .line-title .line-close-image {
  width: 32px;
  height: 32px;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 50%;
  padding: 6px;
}

.modal-line-content .line-title .line-close-image:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%) scale(1.1);
}

.modal-line-content .line-content {
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.modal-line-content .line-content .line-1 {
  position: relative;
  width: 325px;
  height: 172px;
  display: block;
  background: url(../images/line_1.png) no-repeat center center;
  background-size: cover;
}

.modal-line-content .line-content .line-1 .line-click {
  position: absolute;
  width: 200px;
  height: 20px;
  bottom: 13px;
  left: 90px;
  outline: none;
}

.modal-line-content .line-content .line-title-click {
  position: absolute;
  width: 220px;
  height: 30px;
  top: 18px;
  left: 20px;
}

.modal-line-content .line-content .line-2 {
  margin-top: 10px;
  position: relative;
  width: 325px;
  height: 250px;
  display: block;
  background: url(../images/line_2.png) no-repeat center center;
  background-size: cover;
}

.modal-line-content .line-content .line-3 {
  margin-top: 10px;
  position: relative;
  width: 325px;
  height: 248px;
  display: block;
  background: url(../images/line_3.png) no-repeat center center;
  background-size: cover;
}

.modal-line-content .line-content .line-4 {
  margin-top: 10px;
  position: relative;
  width: 325px;
  height: 197px;
  display: block;
  background: url(../images/line_4.png) no-repeat center center;
  background-size: cover;
}

.modal-line-content .line-content .line-5 {
  margin-top: 10px;
  position: relative;
  width: 325px;
  height: 189px;
  display: block;
  background: url(../images/line_5.png) no-repeat center center;
  background-size: cover;
}

/* 引导提示层 - 优化版本 */
.guide-overlay {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 750px;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2000;
  display: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.guide-overlay .guide-image-1,
.guide-overlay .guide-image-2,
.guide-overlay .guide-image-3 {
  position: absolute;
  display: none;
  cursor: pointer;
  transition: all 0.3s ease;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.guide-overlay .guide-image-1:hover,
.guide-overlay .guide-image-2:hover,
.guide-overlay .guide-image-3:hover {
  transform: scale(1.05);
}

.guide-overlay .guide-image-1 {
  width: 284px;
  height: 309px;
  bottom: 30px;
  left: 20px;
}

.guide-overlay .guide-image-2 {
  width: 248px;
  height: 239px;
  top: 280px;
  right: 60px;
}

.guide-overlay .guide-image-3 {
  width: 264px;
  height: 300px;
  top: 40px;
  left: 20px;
}

/* 加载动画 - 优化版本 */
.loading {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1500;
  background: rgba(255, 255, 255, 0.95);
  padding: 30px;
  border-radius: 16px;
  display: none;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.loading.show {
  display: block;
}

.loading div {
  color: #4a5568;
  font-size: 16px;
  font-weight: 500;
  margin-top: 8px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #4ecdc4;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* 隐藏Leaflet默认控件 */
.leaflet-bottom.leaflet-right {
  display: none !important;
}

.leaflet-control-container {
  display: none !important;
}

/* 图例层 */
.legend-container {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  right: 10px;
  z-index: 3;
}

.legend-container .legend-image {
  width: 40px;
  height: auto;
}

/* 版权信息 */
.author {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom) + 4px);
  right: 8px;
  font-size: 12px;
  color: #a0aec0;
  z-index: 3;
  font-weight: 400;
}

/* 响应式设计 */
@media (max-width: 750px) {

  .modal-overlay,
  .modal-line-overlay,
  .guide-overlay {
    left: 0;
    transform: none;
    max-width: none;
  }

  .main-container {
    box-shadow: none;
  }

  body {
    background-color: white;
  }
}

@media (max-width: 480px) {
  .filter-tags {
    top: 10px;
    left: 0;
  }

  .tag-icon {
    width: 100px;
  }

  .modal-content {
    margin: 15px;
    padding: 20px;
    max-width: none;
  }

  .modal-title {
    font-size: 18px;
  }

  .link-buttons {
    gap: 8px;
  }

  .link-btn {
    padding: 8px 12px;
    font-size: 13px;
    flex: 1;
    min-width: calc(50% - 4px);
  }

  .poi-block {
    padding: 12px;
    gap: 10px;
  }

  .guide-overlay .guide-image-1 {
    width: 240px;
    height: auto;
    bottom: 20px;
    left: 15px;
  }

  .guide-overlay .guide-image-2 {
    width: 200px;
    height: auto;
    top: 200px;
    right: 15px;
  }

  .guide-overlay .guide-image-3 {
    width: 220px;
    height: auto;
    top: 30px;
    left: 15px;
  }

  .line-image {
    width: 70px;
    left: 30px;
    bottom: 80px;
  }

  .modal-line-content .line-content {
    min-height: 300px;
  }
}

/* PC端优化 */
@media (min-width: 751px) {
  .tag-button {
    padding: 6px;
  }

  .modal-content {
    margin: 0 30px;
    padding: 28px;
  }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

  .tag-icon,
  .line-image,
  .top-image,
  .bottom-image {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  .modal-content {
    background: #2d3748;
    color: #e2e8f0;
  }

  .modal-title {
    color: #f7fafc;
  }

  .close-button {
    background: #4a5568;
    color: #cbd5e0;
  }

  .close-button:hover {
    background: #2d3748;
    color: #f7fafc;
  }

  .poi-block {
    background: linear-gradient(145deg, #4a5568, #2d3748);
    border-color: #4a5568;
  }

  .poi-label {
    color: #a0aec0;
  }

  .poi-value {
    color: #e2e8f0;
  }

  .poi-summary {
    background: rgba(0, 0, 0, 0.2);
    color: #cbd5e0;
  }

  .loading {
    background: rgba(45, 55, 72, 0.95);
    color: #e2e8f0;
  }

  .loading div {
    color: #cbd5e0;
  }
}