body{
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 20px;
  background: #f5f5f5;
  color: #222;
}

.container{
  max-width: 1000px;
  margin: 0 auto;
}

h2, h3{
  margin-top: 0;
}

.search{
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

label{
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: bold;
  color: #333;
}

input,
select,
textarea{
  width: 100%;
  padding: 12px;
  font-size: 16px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
}

input:focus,
select:focus,
textarea:focus{
  outline: none;
  border-color: #1565c0;
  box-shadow: 0 0 0 2px rgba(21, 101, 192, 0.12);
}

select{
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #666 50%),
    linear-gradient(135deg, #666 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 42px;
}

button{
  padding: 12px 16px;
  font-size: 15px;
  cursor: pointer;
  border: 1px solid #bbb;
  border-radius: 6px;
  background: #fff;
  transition: background 0.15s ease, opacity 0.15s ease;
}

button:hover{
  background: #f0f0f0;
}

button:disabled{
  background: #e9ecef;
  color: #777;
  cursor: not-allowed;
  opacity: 0.9;
}

#poleInput{
  flex: 1;
}

.info,
.save-box{
  background: #fff;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 15px;
  border: 1px solid #ddd;
}

.row{
  margin-bottom: 8px;
  line-height: 1.5;
}

.row:last-child{
  margin-bottom: 0;
}

.label{
  font-weight: bold;
  width: 145px;
  display: inline-block;
}

.save-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}

.full{
  grid-column: 1 / -1;
  width: 100%;
}

.button-row{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button-row button{
  min-width: 110px;
}

.notice{
  font-size: 14px;
  color: #555;
  margin-top: 8px;
}

.helper{
  margin-top: 8px;
  font-size: 13px;
  color: #666;
  line-height: 1.5;
}

.gps-status{
  margin-top: 8px;
  font-size: 13px;
  color: #444;
  line-height: 1.5;
}

.accuracy-warning{
  margin-top: 8px;
  font-size: 13px;
  font-weight: bold;
  line-height: 1.5;
}

.warn-ok{
  color: #2e7d32;
}

.warn-mid{
  color: #ef6c00;
}

.warn-high{
  color: #d84315;
}

.map-wrapper{
  position: relative;
}

#map{
  width: 100%;
  height: 520px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #eee;
}

.legend{
  position: absolute;
  bottom: 15px;
  left: 15px;
  background: rgba(255, 255, 255, 0.96);
  padding: 10px 12px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  font-size: 13px;
  z-index: 10;
  max-width: 320px;
}

.legend-item{
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  line-height: 1.4;
}

.legend-item:last-child{
  margin-bottom: 0;
}

.legend-dot{
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  flex: 0 0 12px;
}

.legend-dot.real{
  background: #1565c0;
}

.legend-dot.estimated{
  background: #ef6c00;
}

.legend-dot.gps{
  background: #e53935;
}

.legend-dot.input{
  background: #2e7d32;
}

.badge{
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 13px;
  margin-left: 8px;
  vertical-align: middle;
}

.badge-exact{
  background: #e3f2fd;
  color: #1565c0;
}

.badge-est{
  background: #fff3e0;
  color: #ef6c00;
}

.guide-title{
  margin-top: 12px;
  color: #d84315;
  font-weight: bold;
}

.guide-text{
  color: #555;
  line-height: 1.5;
}

.loading-inline{
  display: inline-flex;
  align-items: center;
  font-weight: bold;
  color: #1565c0;
}

.dots{
  display: inline-flex;
  margin-left: 4px;
  width: 18px;
  justify-content: space-between;
}

.dots span{
  animation: blink 1.2s infinite;
  opacity: 0.2;
}

.dots span:nth-child(2){
  animation-delay: 0.2s;
}

.dots span:nth-child(3){
  animation-delay: 0.4s;
}

@keyframes blink{
  0%, 80%, 100%{
    opacity: 0.2;
    transform: translateY(0);
  }
  40%{
    opacity: 1;
    transform: translateY(-1px);
  }
}

@media (max-width: 768px){
  body{
    padding: 12px;
  }

  .search{
    flex-direction: column;
  }

  .save-grid{
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .label{
    width: 110px;
  }

  .button-row{
    flex-direction: column;
  }

  .button-row button{
    width: 100%;
  }

  #map{
    height: 420px;
  }

  .legend{
    left: 10px;
    right: 10px;
    bottom: 10px;
    font-size: 12px;
    max-width: none;
  }
}
