:root {
  color-scheme: light;
  --panel-bg: #ffffff;
  --text: #1c1c1c;
  --muted: #666;
  --border: #ddd;
  --accent: #2b6cb0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: #f5f5f5;
}

#map {
  position: fixed;
  inset: 0;
}

#panel {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  width: 300px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  background: var(--panel-bg);
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
  padding: 14px 16px;
}

#panel h1 {
  font-size: 1.05rem;
  margin: 0 0 10px;
}

.field {
  margin-bottom: 10px;
}

.field label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 3px;
}

.checkbox-field label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text);
}

input[type="date"],
input[type="number"],
select {
  width: 100%;
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
}

input[type="range"] {
  width: 100%;
}

.hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

#params-panel {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-bottom: 10px;
}

#params-panel summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
}

#penalty-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

#penalty-table td {
  padding: 2px 4px;
}

#penalty-table input {
  width: 100%;
}

#params-reset {
  font-size: 0.78rem;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f0f0f0;
  cursor: pointer;
}

#legend {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-bottom: 8px;
}

#legend-gradient {
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(to right, #d73027, #f6e37e, #1a9850);
}

#legend-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
}

#footer {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

#footer a {
  color: var(--accent);
}

.leaflet-popup-content {
  font-size: 0.82rem;
}

.leaflet-popup-content table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 6px;
}

.leaflet-popup-content th,
.leaflet-popup-content td {
  padding: 2px 5px;
  border-bottom: 1px solid #eee;
  text-align: right;
}

.leaflet-popup-content th:first-child,
.leaflet-popup-content td:first-child {
  text-align: left;
}

@media (max-width: 640px) {
  #panel {
    width: calc(100vw - 24px);
    max-height: 45vh;
  }
}
