* { margin:0; padding:0; box-sizing:border-box; }
body {
  background: #0b0f15;
  font-family: 'Segoe UI', 'Inter', system-ui, -apple-system, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1rem;
  color: #e7e9ea;
}
#app {
  width: 100%;
  max-width: 1300px;
  background: rgba(18,22,28,0.85);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 2rem;
  padding: 1.5rem;
  box-shadow: 0 25px 60px -15px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
}
.logo h1 {
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #b6f0ff 0%, #5ed7ff 70%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.upload-area {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: #1e242c;
  border-radius: 3rem;
  padding: 0.3rem 0.3rem 0.3rem 1rem;
  border: 1px solid rgba(255,255,255,0.1);
}
.upload-area label {
  background: #2e3a47;
  padding: 0.5rem 1.2rem;
  border-radius: 2.5rem;
  font-weight: 500;
  font-size: 0.8rem;
  cursor: pointer;
  transition: 0.2s;
  color: #d0e2ff;
}
.upload-area label:hover {
  background: #3f5068;
}
#file-input {
  display: none;
}
#file-name {
  color: #94a3b8;
  font-size: 0.8rem;
  margin-right: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.visualization {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  background: #0f1319;
  border-radius: 1.5rem;
  padding: 1rem;
  border: 1px solid rgba(255,255,255,0.06);
}
.chart-title {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 600;
  background: linear-gradient(135deg, #ffc857 0%, #ff8c42 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  outline: none;
  border: none;
  padding: 0.1rem 0;
  margin-bottom: 0.2rem;
  cursor: text;
}
.chart-title:empty:before {
  content: attr(data-placeholder);
  opacity: 0.5;
  background: none;
  -webkit-text-fill-color: rgba(255,255,255,0.3);
}
.stats-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  background: rgba(255,255,255,0.03);
  border-radius: 1.5rem;
  padding: 0.8rem 1rem;
  backdrop-filter: blur(8px);
  justify-content: center;
}
.stat-item {
  display: flex;
  flex-direction: column;
  min-width: 60px;
}
.stat-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7f8ea3;
}
.stat-value {
  font-size: 1rem;
  font-weight: 600;
  color: #f0f6ff;
  line-height: 1.2;
}
.stat-unit {
  font-size: 0.6rem;
  color: #6b7b94;
  margin-left: 0.1rem;
}

.map-wrapper {
  border-radius: 1.2rem;
  overflow: hidden;
  position: relative;
  background: #0a0c10;
}
.map-container {
  width: 100%;
  height: 40vh;
  min-height: 280px;
}
.static-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0a0c10;
}

.profile-container {
  width: 100%;
  background: #12171e;
  border-radius: 1.2rem;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
}
.profile-title {
  font-size: 0.65rem;
  color: #94a6c0;
  margin-left: 0.4rem;
  margin-bottom: 0.2rem;
}
canvas#elevationCanvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0.8rem;
  cursor: crosshair;
}

.actions {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.btn {
  background: rgba(46,58,71,0.7);
  border: 1px solid rgba(255,255,255,0.15);
  color: #e0ecff;
  padding: 0.6rem 1.5rem;
  border-radius: 2.5rem;
  font-weight: 500;
  font-size: 0.8rem;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: 0.2s;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.btn:hover {
  background: #3d5068;
  border-color: rgba(255,255,255,0.3);
  color: white;
}
.btn-primary {
  background: #1f6d8f;
  border-color: #3da2c7;
}
.btn-primary:hover {
  background: #2980a3;
}
.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.toggle-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.05);
  padding: 0.4rem 0.8rem;
  border-radius: 2rem;
  color: #a0b3cc;
  font-size: 0.75rem;
  cursor: pointer;
}
.toggle-switch input[type=checkbox] {
  appearance: none;
  width: 36px;
  height: 20px;
  background: #2e3a47;
  border-radius: 10px;
  position: relative;
  outline: none;
  cursor: pointer;
  transition: 0.2s;
}
.toggle-switch input[type=checkbox]:before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: 0.2s;
}
.toggle-switch input[type=checkbox]:checked {
  background: #1f6d8f;
}
.toggle-switch input[type=checkbox]:checked:before {
  transform: translateX(16px);
}

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

/* 模态弹窗 */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.9);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  padding: 1rem;
}
.modal-overlay.active {
  display: flex;
}
.modal-content {
  background: #1a1f28;
  border-radius: 1.5rem;
  padding: 1rem;
  max-width: 95vw;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.modal-content img {
  max-width: 100%;
  height: auto;
  border-radius: 1rem;
}
.modal-close {
  margin-top: 1rem;
  background: #2e3a47;
  color: white;
  border: none;
  padding: 0.5rem 2rem;
  border-radius: 2rem;
  font-weight: 500;
  cursor: pointer;
  font-size: 0.9rem;
}
.modal-close:hover {
  background: #3f5068;
}

/* 手机端微调 */
@media (max-width: 600px) {
  body {
    padding: 0.5rem;
  }
  #app {
    border-radius: 1.5rem;
    padding: 1rem;
    gap: 1rem;
  }
  .logo h1 {
    font-size: 1.3rem;
  }
  .upload-area label {
    padding: 0.4rem 1rem;
    font-size: 0.75rem;
  }
  .map-container {
    height: 30vh;
    min-height: 240px;
  }
  .stats-panel {
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
  }
  .stat-value {
    font-size: 0.9rem;
  }
  .chart-title {
    font-size: 1.2rem;
  }
  .btn {
    padding: 0.5rem 1.2rem;
    font-size: 0.75rem;
  }
}