:root {
  --bg: #12181b;
  --panel: #1b2428;
  --panel-border: #2c383e;
  --text: #eef2f3;
  --text-dim: #a6b3b8;
  --accent: #f4b942;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
}

#app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

#map {
  flex: 1;
  height: 100%;
  background: #0d1113;
}

#panel {
  width: 340px;
  min-width: 340px;
  height: 100%;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--panel-border);
  padding: 18px 20px 28px;
}

#panel h1 {
  font-size: 1.25rem;
  line-height: 1.3;
  margin: 0 0 4px;
}

#panel .subtitle {
  color: var(--accent);
  font-size: 0.85rem;
  margin: 0 0 16px;
}

#panel p {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-dim);
}

.section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--panel-border);
}

.section h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin: 0;
}

details.section summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 0 10px;
  margin: -2px 0 0;
  -webkit-tap-highlight-color: transparent;
}

details.section summary::-webkit-details-marker { display: none; }

details.section summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  transform: rotate(-45deg);
  margin-left: 10px;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

details.section[open] summary::after {
  transform: rotate(45deg);
}

details.section summary:hover h2 {
  color: var(--text);
}

details.section > *:not(summary):last-child {
  margin-bottom: 0;
}

#search-form {
  display: flex;
  gap: 6px;
}

#search-input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: #0f1517;
  color: var(--text);
  font-size: 0.85rem;
}

button {
  border: 1px solid var(--panel-border);
  background: #24312f;
  color: var(--text);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.85rem;
  cursor: pointer;
}

button:hover { background: #2d3b39; }

#gps-btn { width: 100%; margin-top: 8px; }

.legend-gradient {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(to right, #b2182b, #f7de6c, #238b45);
  margin-bottom: 4px;
}

.legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.always-visible {
  margin-top: 14px;
  padding: 10px 12px;
  background: #1f2a2e;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.hint {
  margin: 4px 0 0;
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.info-box {
  background: #241d12;
  border: 1px solid #4a3a19;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.78rem;
  color: #e6c878;
  line-height: 1.45;
}

.info-box strong { color: #f4d27a; }

#sun-sim {
  display: flex;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, #2a1f33 0%, #0d1113 75%);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 10px;
}

#sun-canvas {
  display: block;
}

.sim-caption {
  margin: 6px 0 10px;
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
}

.sim-caption a { color: var(--accent); }

#peakfinder-box {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  overflow: hidden;
  background: #0f1517;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#peakfinder-box p.empty {
  padding: 16px;
  text-align: center;
  margin: 0;
}

#peakfinder-box iframe {
  display: block;
  width: 100%;
  height: 320px;
  border: 0;
}

#result-box {
  margin-top: 10px;
  font-size: 0.85rem;
  line-height: 1.5;
}

#result-box .pct {
  font-size: 1.8rem;
  font-weight: 700;
}

#result-box .empty {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.hillshade-layer {
  mix-blend-mode: multiply;
}

.leaflet-popup-content-wrapper {
  background: var(--panel);
  color: var(--text);
}
.leaflet-popup-tip { background: var(--panel); }

footer.credits {
  margin-top: 20px;
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.author-credit {
  margin: 8px 0 0;
  font-size: 0.7rem;
  color: var(--text-dim);
}

.visit-counter {
  margin: 4px 0 0;
  font-size: 0.7rem;
  color: var(--text-dim);
  opacity: 0.8;
}

@media (max-width: 760px) {
  #app { flex-direction: column-reverse; }
  #panel {
    width: 100%;
    min-width: 0;
    height: 45vh;
    border-right: none;
    border-top: 1px solid var(--panel-border);
  }
  #map { height: 55vh; }
}
