:root {
  --bg: #11131a;
  --panel: #181b24;
  --panel-2: #1f232e;
  --border: #2b3040;
  --text: #e8eaf0;
  --muted: #9aa1b4;
  --accent: #e4154b;      /* DQ red */
  --book: #3b82f6;        /* bookstore blue */
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: 100%;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 20px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.panel-head h1 {
  margin: 0 0 6px;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.dq { color: var(--accent); }

.sub, .hint, .credits {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.controls { display: flex; flex-direction: column; gap: 14px; }

button.primary {
  appearance: none;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 11px 14px;
  cursor: pointer;
}

button.primary:hover:not(:disabled) { filter: brightness(1.1); }
button.primary:disabled { background: var(--panel-2); color: var(--muted); cursor: not-allowed; }

.origin {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--muted);
}

.field { display: flex; flex-direction: column; gap: 7px; font-size: 13px; }

.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.label-row output { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }

input[type="range"] {
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: var(--border);
  outline-offset: 4px;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text);
  border: 3px solid var(--accent);
  cursor: pointer;
}

.units { display: flex; gap: 6px; }

.unit {
  flex: 1;
  appearance: none;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px;
  font-size: 13px;
  cursor: pointer;
}

.unit.active { background: var(--border); color: var(--text); }

.status {
  border-radius: var(--radius);
  padding: 11px 13px;
  font-size: 13px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.status.error { border-color: #7a2436; background: #2a151b; color: #ffc2cf; }

.results { display: flex; flex-direction: column; gap: 9px; }

.summary {
  font-size: 13px;
  color: var(--muted);
  padding-bottom: 2px;
}

.card {
  text-align: left;
  width: 100%;
  appearance: none;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--book);
  border-radius: 9px;
  padding: 11px 13px;
  color: var(--text);
  cursor: pointer;
}

.card:hover { border-color: var(--book); }

.card h3 { margin: 0 0 3px; font-size: 14.5px; }
.card p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.card .near { color: var(--accent); font-weight: 600; }

.credits { margin-top: auto; padding-top: 8px; font-size: 12px; }
.credits a { color: var(--muted); }

#map { height: 100%; width: 100%; background: #e8e4dd; }

.leaflet-popup-content { font-size: 13px; line-height: 1.45; }
.leaflet-popup-content strong { display: block; font-size: 14px; margin-bottom: 2px; }
.leaflet-popup-content a { color: #1d4ed8; }

.pin {
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.pin-dq { background: var(--accent); }
.pin-dq-dim { background: #8a8f9e; }
.pin-book { background: var(--book); }
.pin-me { background: #22c55e; border-radius: 50%; transform: none; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 60vh; height: auto; }
  .panel { border-right: 0; border-bottom: 1px solid var(--border); }
  #map { height: 60vh; }
}
