/* 全局重置，优化移动端体验 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  display: flex; /* 保留flex布局 */
  padding: 3vh;
  height: 100vh;
  overflow: hidden;
  position: relative; /* 新增：为固定定位元素提供参考 */
}

/* 左侧悬浮图层控制面板（仿天地图样式） */
.layer-panel {
  position: fixed;
  top: 0;
  left: 0;
  transform: translateX(-240px);
  width: 240px;
  height: 100%;
  background: #fff;
  border-right: 1px solid #e5e5e5;
  padding: 15px 10px;
  overflow-y: auto;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
  z-index: 1666;
  transition: transform 0.3s ease;
  padding-top: 1vh;
  box-sizing: border-box;
}

/* 【修复】提升active类优先级，明确覆盖默认transform */
.layer-panel.active {
  transform: translateX(0) !important;
}

/* 悬浮触发按钮（logo/手柄） */
.layer-trigger {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 40px;
  height: 80px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-left: none;
  border-radius: 0 8px 8px 0;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
  z-index: 1006;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  color: #666;
  font-size: 14px;
  transition: background 0.2s;
}

.layer-trigger:active {
  background: #f5f5f5;
  color: #333;
}

.layer-panel h3 {
  font-size: 16px;
  color: #333;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}
.layer-item {
  display: flex;
  align-items: center;
  padding: 8px 5px;
  margin-bottom: 5px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
.layer-item:hover {
  background: #f5f5f5;
}
.layer-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-right: 10px;
  cursor: pointer;
}
.layer-item label {
  flex: 1;
  font-size: 14px;
  color: #666;
  cursor: pointer;
}

#map {
  flex: 1; /* 保留flex布局的自适应 */
  height: 100%;
  width: min(90%, 100vw - 20px);
  margin: 0 auto;
  position: relative;
  border: min(1.6px, 1vh) dashed #99cc99;
  border-radius: max(6px, 0.6vw);
  overflow: hidden;
  touch-action: pan-x pan-y;
  transition: box-shadow 0.3s ease;
}

#map:active {
  box-shadow: 0 0 16px rgba(153, 204, 153, 0.6);
}
