* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  overflow: hidden;
}

#map {
  width: 100vw;
  height: 100vh;
}

/* 控制面板 */
#panel {
  position: fixed;
  top: 10px;
  right: 10px;
  width: 320px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  z-index: 10000;
  overflow: hidden;
  transition: transform 0.2s;
}

#panel.collapsed #panel-body {
  display: none;
}

#panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #2c3e50;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

#panel-toggle {
  font-size: 16px;
  cursor: pointer;
  width: 24px;
  text-align: center;
}

#panel-body {
  padding: 12px 14px;
}

.section {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

.section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.section-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 6px;
}

.hint {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
  line-height: 1.5;
}

.hint-inline {
  font-size: 12px;
  color: #555;
  font-family: "Consolas", "Monaco", monospace;
}

.size-input {
  width: 70px;
  padding: 4px 6px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
  font-family: "Consolas", "Monaco", monospace;
  text-align: right;
}

.btn-tiny {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #ecf0f1;
  cursor: pointer;
  font-size: 14px;
  line-height: 22px;
  text-align: center;
  color: #555;
  flex-shrink: 0;
}

.btn-tiny:hover {
  background: #d5dbdb;
}

.row {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
}

.row label {
  font-size: 12px;
  color: #555;
  white-space: nowrap;
  min-width: 80px;
}

.row input[type="number"] {
  width: 80px;
  padding: 4px 6px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
}

.row input[type="range"] {
  flex: 1;
  accent-color: #2980b9;
}

#opacity-val {
  font-size: 12px;
  color: #555;
  min-width: 32px;
}

#file-input {
  width: 100%;
  font-size: 12px;
}

.btn-primary {
  width: 100%;
  padding: 8px;
  background: #2980b9;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 6px;
}

.btn-primary:hover {
  background: #2471a3;
}

.btn-secondary {
  width: 48%;
  padding: 6px;
  background: #ecf0f1;
  color: #2c3e50;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #d5dbdb;
}

/* 坐标显示 */
#coord-display {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 10000;
}

#coord-display span {
  font-family: "Consolas", "Monaco", monospace;
  font-weight: 600;
  color: #5dade2;
}

#coord-crs {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  font-size: 11px;
  color: #fff !important;
}

.coord-crs-btn {
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.15s;
}

.coord-crs-btn:hover {
  background: rgba(255,255,255,0.35) !important;
}

/* 方向键微调面板 */
.dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.dpad-row {
  display: flex;
  gap: 2px;
}

.btn-dpad {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  background: #ecf0f1;
  cursor: pointer;
  font-size: 14px;
  line-height: 30px;
  text-align: center;
  color: #555;
  user-select: none;
  transition: background 0.15s;
}

.btn-dpad:hover {
  background: #d5dbdb;
}

.btn-dpad:active {
  background: #bdc3c7;
}

/* 十字准星 */
#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  pointer-events: none;
  z-index: 10001;
}

#crosshair::before,
#crosshair::after {
  content: '';
  position: absolute;
  background: rgba(255, 0, 0, 0.7);
}

#crosshair::before {
  top: 0;
  left: 50%;
  width: 2px;
  height: 100%;
  transform: translateX(-50%);
}

#crosshair::after {
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  transform: translateY(-50%);
}
