* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

#map { height: 100%; }

#panel {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  width: 320px;
  max-height: calc(100% - 24px);
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  padding: 14px 16px;
}

#panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

#panel h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.04em;
}

#panel-toggle {
  border: none;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  color: #374151;
  transition: transform 0.15s;
}

#panel.collapsed #panel-toggle { transform: rotate(-90deg); }
#panel.collapsed #panel-body { display: none; }

#panel-body { margin-top: 4px; }

.subtitle {
  margin: 4px 0 12px;
  font-size: 13px;
  color: #444;
}

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

.search { position: relative; margin-bottom: 8px; }

.search input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #bbb;
  border-radius: 6px;
  font-size: 13px;
}

.search input:focus { outline: 2px solid #1d4ed8; border-color: transparent; }

.results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 1100;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  max-height: 220px;
  overflow-y: auto;
}

.results li {
  padding: 6px 10px;
  font-size: 12.5px;
  cursor: pointer;
}

.results li:hover { background: #eef2ff; }
.results li.hint { color: #666; cursor: default; }
.results li.hint:hover { background: none; }

.seg input { display: none; }

.seg span {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid #bbb;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.seg input:checked + span {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}

#clear {
  margin-left: auto;
  border: 1px solid #bbb;
  background: #fff;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  cursor: pointer;
}

.slider-row label { font-size: 13px; white-space: nowrap; }
.slider-row input { flex: 1; }
#alpha-value { font-size: 13px; font-weight: 600; width: 52px; text-align: right; }

#status {
  font-size: 13px;
  color: #333;
  min-height: 18px;
  margin-bottom: 8px;
}

#status.error { color: #b91c1c; }

#stats {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 10px;
}

#stats th, #stats td {
  text-align: right;
  padding: 3px 4px;
  border-bottom: 1px solid #eee;
}

#stats td:first-child { text-align: left; color: #555; }
#stats .c-short { color: #6b7280; }
#stats .c-avoid { color: #15803d; }

/* avoidance off: only one route exists, hide the comparison column */
#stats.single th:nth-child(3),
#stats.single td:nth-child(3) { display: none; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12px;
  color: #444;
  margin-bottom: 8px;
}

.legend .sw {
  display: inline-block;
  width: 18px;
  height: 4px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 4px;
}

.sw-short { background: #6b7280; }
.sw-avoid { background: #16a34a; }
.sw-exposed { background: #dc2626; }

.legend .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #dc2626;
  opacity: 0.7;
  vertical-align: middle;
  margin-right: 4px;
}

.disclaimer {
  font-size: 11px;
  color: #666;
  margin: 0;
}

.marker-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.marker-pin span { transform: rotate(45deg); }
.marker-a { background: #16a34a; }
.marker-b { background: #dc2626; }

@media (max-width: 640px) {
  #panel {
    left: 12px;
    right: 12px;
    width: auto;
    padding: 10px 14px;
    max-height: 70%;
  }
  #panel h1 { font-size: 18px; }
  .subtitle { margin-bottom: 8px; }
}
