html, body { height: 100%; margin: 0; }
body { font: 13px/1.45 system-ui, "Segoe UI", sans-serif; }
#map { height: 100%; }

.card {
  background: rgba(23, 25, 30, 0.92);
  color: #e8e9ec;
  border-radius: 10px;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}

#panel {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 300px;
  max-height: calc(100% - 24px);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 12px 16px 14px;
}

.panel-header { display: flex; align-items: center; justify-content: space-between; user-select: none; }
.panel-header h1 { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: 0.2px; }
#collapseBtn {
  background: none; border: none; color: #9aa0ab; font-size: 16px; line-height: 1;
  cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
#collapseBtn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
#panel.collapsed #panelBody { display: none; }
#panel.collapsed { width: auto; }

#panelBody { display: flex; flex-direction: column; min-height: 0; }
#panelBody > * + * { margin-top: 10px; }
#panelBody p { margin-bottom: 0; }
#panelBody > :first-child { margin-top: 8px; }

.status { color: #c6c9cf; font-variant-numeric: tabular-nums; }
.status.error { color: #f28b82; }
.hint { color: #9aa0ab; }
kbd {
  background: #2a2d34; border: 1px solid #3c404a; border-radius: 4px;
  padding: 0 4px; font: 11px ui-monospace, Consolas, monospace;
}

.row { display: flex; align-items: center; gap: 8px; cursor: pointer; }
input[type="checkbox"] { accent-color: #5b8def; }

#selection { display: flex; flex-direction: column; min-height: 0; gap: 8px; }
#selection[hidden] { display: none; }
.sel-summary { font-variant-numeric: tabular-nums; }
.sel-summary strong { font-size: 18px; color: #ffb366; }
.sel-center { display: block; color: #9aa0ab; font-size: 11px; }

.radius-row { display: flex; align-items: center; gap: 8px; color: #c6c9cf; }
#radius, #keyInput {
  background: #2a2d34;
  color: #e8e9ec;
  border: 1px solid #3c404a;
  border-radius: 6px;
  padding: 4px 6px;
  font: inherit;
}
#radius { width: 90px; font-variant-numeric: tabular-nums; }
input:focus-visible, button:focus-visible { outline: 2px solid #5b8def; outline-offset: 1px; }

.buttons { display: flex; gap: 8px; }
.buttons button {
  flex: 1; padding: 7px 0; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer;
  background: #2a2d34; color: #e8e9ec; border: 1px solid #3c404a;
}
.buttons button:hover:not(:disabled) { background: #343842; }
.buttons button.primary { flex: 2; background: #f57c00; border-color: #f57c00; color: #1b1205; }
.buttons button.primary:hover:not(:disabled) { background: #ff8f1f; }
.buttons button:disabled { opacity: 0.45; cursor: default; }

.warn { color: #fdd663; font-size: 12px; }
.fineprint { font-size: 11px; color: #9aa0ab; }

#list {
  list-style: none; margin: 0; padding: 0;
  overflow-y: auto; min-height: 0; flex: 1 1 auto; max-height: 40vh;
  border-top: 1px solid #3c404a;
}
#list li {
  display: grid; grid-template-columns: 44px 1fr; column-gap: 8px;
  padding: 6px 2px; border-bottom: 1px solid #2c2f37; cursor: pointer;
}
#list li:hover { background: rgba(255, 255, 255, 0.05); }
#list .dist { color: #ffb366; font-variant-numeric: tabular-nums; text-align: right; }
#list .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#list .meta { grid-column: 2; color: #9aa0ab; font-size: 11px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.attrib { color: #9aa0ab; font-size: 11px; line-height: 1.6; }
.attrib a { color: #8fb6f0; }
.swatch {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  vertical-align: -1px; border: 1px solid rgba(255, 255, 255, 0.85);
}
.swatch.dot { background: #3b6fd8; }
.swatch.sel { background: #f57c00; margin-left: 6px; }

/* ---- station info window (rendered inside Google's white bubble) ---- */
.st-info { font: 13px/1.5 system-ui, "Segoe UI", sans-serif; color: #202124; }
.st-name { font-size: 14px; font-weight: 600; }
.st-addr, .st-gps { color: #5f6368; }
.st-gps { font-size: 11px; margin-top: 4px; }
.st-fuel { margin-top: 4px; }
.st-actions { display: flex; gap: 12px; margin-top: 6px; }
.st-info a, .st-info button {
  color: #1a73e8; text-decoration: none; background: none; border: none; padding: 0;
  font: inherit; cursor: pointer;
}
.st-info a:hover, .st-info button:hover { text-decoration: underline; }

/* ---- API key dialog ---- */
#keyDialog {
  background: #1c1e24;
  color: #e8e9ec;
  border: 1px solid #3c404a;
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  width: min(440px, 90vw);
  padding: 20px 24px;
}
#keyDialog::backdrop { background: rgba(8, 10, 14, 0.7); backdrop-filter: blur(2px); }
#keyDialog h1 { font-size: 17px; margin: 0 0 8px; }
#keyDialog p, #keyDialog ol { margin: 8px 0; color: #c6c9cf; }
#keyDialog ol { padding-left: 20px; }
#keyDialog li { margin: 4px 0; }
#keyDialog a { color: #8fb6f0; }
#keyDialog code {
  background: #2a2d34; padding: 1px 5px; border-radius: 4px;
  font-size: 12px; font-family: ui-monospace, Consolas, monospace;
}
#keyInput { width: 100%; box-sizing: border-box; margin-top: 6px; padding: 8px 10px; }
#keyGo {
  margin-top: 12px; width: 100%;
  background: #5b8def; color: #fff; border: none; border-radius: 8px;
  padding: 9px 0; font: inherit; font-weight: 600; cursor: pointer;
}
#keyGo:hover { background: #6d9af0; }
.key-error { color: #f28b82; }

/* ---- phones: panel docks under the map (an overlay would hide Google's
   controls and attribution) ---- */
@media (max-width: 600px) {
  body { display: flex; flex-direction: column; height: 100dvh; }
  #map { flex: 1 1 auto; height: auto; min-height: 0; }
  #panel {
    position: static; width: auto; max-height: 45dvh;
    border-radius: 0; padding: 10px 14px 12px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.35);
  }
  #panel.collapsed { width: auto; }
  #list { max-height: none; }
  .hint .esc { display: none; }
}
