/* ============================================================ foundations */
:root {
  --bg: #0e1116;
  --panel: rgba(20, 25, 33, 0.93);
  --panel-solid: #161b23;
  --edge: rgba(255, 255, 255, 0.10);
  --edge-strong: rgba(255, 255, 255, 0.18);
  --ink: #e9edf3;
  --ink-dim: #97a1b0;
  --ink-faint: #6b7686;
  --accent: #5b9dff;
  --danger: #f2555a;
  --ok: #35c48a;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --topbar-h: 46px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
}

button, input, textarea, select { font: inherit; color: inherit; }

.app { position: fixed; inset: 0; }
.app[hidden] { display: none; }

.stage { position: absolute; inset: 0; width: 100%; height: 100%; }
#globe { display: block; background: var(--bg); touch-action: none; cursor: grab; }
#globe.is-dragging { cursor: grabbing; }
#globe[hidden] { display: none; }

/* ================================================================ buttons */
.btn {
  border: 1px solid var(--edge-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border-radius: 9px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, opacity 0.14s;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: transparent; color: #06121f; font-weight: 640; }
.btn-primary:hover:not(:disabled) { background: #74acff; }
.btn-danger { color: var(--danger); border-color: rgba(242, 85, 90, 0.45); background: rgba(242, 85, 90, 0.10); }
.btn-danger:hover:not(:disabled) { background: rgba(242, 85, 90, 0.2); }
.btn-wide { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }

.icon-btn {
  border: 1px solid var(--edge);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-dim);
  border-radius: 8px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  cursor: pointer; flex: none;
  transition: background 0.14s, color 0.14s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.12); color: var(--ink); }
.icon-btn.tiny { width: 24px; height: 24px; font-size: 13px; border-radius: 7px; }

.linkish {
  background: none; border: none; padding: 0;
  color: var(--accent); font-size: 11.5px; cursor: pointer; text-decoration: none;
}
.linkish:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- tooltip */
/* A real popup rather than the browser's slow, unstyled title attribute. */
.tip { position: relative; }
.tip::after {
  content: attr(data-tip);
  position: absolute; left: calc(100% + 9px); top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: var(--panel-solid); color: var(--ink);
  border: 1px solid var(--edge-strong); border-radius: 7px;
  padding: 5px 9px; font-size: 11.5px; line-height: 1.3; white-space: nowrap;
  box-shadow: var(--shadow); pointer-events: none;
  opacity: 0; visibility: hidden;
  transition: opacity 0.13s ease, transform 0.13s ease, visibility 0.13s;
  z-index: 640;
}
.tip:hover:not(:disabled)::after,
.tip:focus-visible::after {
  opacity: 1; visibility: visible; transform: translateY(-50%) translateX(0);
}

.zoom-divider {
  width: 16px; height: 1px; background: var(--edge); flex: none; margin: 1px 0;
}
#zoom-target:disabled { opacity: 0.32; cursor: default; }
#zoom-target:not(:disabled) { color: var(--accent); border-color: rgba(91, 157, 255, 0.35); }

/* ================================================================== gate */
.gate {
  position: fixed; inset: 0; z-index: 900;
  display: grid; place-items: center;
  background: radial-gradient(1200px 700px at 50% -10%, #1b2536 0%, #0b0e13 60%);
  padding: 20px;
}
.gate[hidden] { display: none; }
.gate-card {
  width: min(360px, 100%);
  background: var(--panel-solid);
  border: 1px solid var(--edge);
  border-radius: 16px;
  padding: 26px 24px;
  box-shadow: var(--shadow);
  text-align: center;
}
.gate-mark { font-size: 30px; }
.gate-card h1 { margin: 6px 0 4px; font-size: 19px; letter-spacing: -0.01em; }
.gate-sub { margin: 0 0 20px; color: var(--ink-faint); font-size: 12.5px; }
.gate-who { display: grid; grid-auto-flow: column; gap: 8px; margin-bottom: 16px; }
.gate-who button {
  border: 1px solid var(--edge); background: rgba(255, 255, 255, 0.04);
  border-radius: 10px; padding: 11px 8px; cursor: pointer; color: var(--ink-dim);
  transition: all 0.14s;
}
.gate-who button.is-on { border-color: var(--accent); background: rgba(91, 157, 255, 0.15); color: var(--ink); font-weight: 600; }
.field { display: block; text-align: left; margin-bottom: 16px; }
.field > span { display: block; font-size: 11.5px; color: var(--ink-faint); margin-bottom: 6px; letter-spacing: 0.04em; text-transform: uppercase; }
.field input {
  width: 100%; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--edge);
  border-radius: 9px; padding: 10px 11px; outline: none; transition: border-color 0.14s;
}
.field input:focus { border-color: var(--accent); }
.gate-error { color: var(--danger); font-size: 12.5px; margin: 12px 0 0; }

/* =============================================================== surfaces */
.glass {
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--edge);
  box-shadow: var(--shadow);
}

/* ================================================================ top row */
.topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 560;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  background: rgba(14, 17, 22, 0.86);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--edge);
}
.topbar-gap { flex: 1; }

.seg {
  display: flex; background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--edge); border-radius: 9px; padding: 2px;
}
.seg-btn {
  border: none; background: transparent; color: var(--ink-dim);
  padding: 5px 13px; border-radius: 7px; cursor: pointer; font-size: 12.5px;
  transition: background 0.14s, color 0.14s;
}
.seg-btn.is-on { background: rgba(255, 255, 255, 0.14); color: var(--ink); font-weight: 600; }

.basemap-wrap {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--edge); border-radius: 9px; padding: 2px;
}
.basemap-wrap[hidden] { display: none; }
#basemap {
  background: transparent; border: none; outline: none; color: var(--ink-dim);
  padding: 5px 8px; border-radius: 7px; cursor: pointer; font-size: 12.5px;
}
#basemap option { background: var(--panel-solid); color: var(--ink); }

.account { position: relative; }
.who {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px;
  min-width: 0; cursor: pointer;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--edge);
  border-radius: 9px; padding: 6px 10px; color: inherit;
  transition: background 0.14s;
}
.who:hover { background: rgba(255, 255, 255, 0.11); }
.who .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.who .dot.is-off { background: var(--ink-faint); }
.who b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .caret { color: var(--ink-faint); font-size: 10px; }

.account-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 620;
  min-width: 178px; padding: 5px;
  background: var(--panel-solid); border: 1px solid var(--edge-strong);
  border-radius: 10px; box-shadow: var(--shadow);
  display: grid; gap: 2px;
}
.account-menu[hidden] { display: none; }
.account-menu button {
  text-align: left; background: none; border: none; color: var(--ink);
  padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 12.5px;
}
.account-menu button:hover { background: rgba(255, 255, 255, 0.09); }

/* ================================================================== modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 800;
  display: grid; place-items: center; padding: 20px;
  background: rgba(6, 9, 14, 0.66);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.modal-backdrop[hidden] { display: none; }
.modal-card {
  width: min(340px, 100%);
  background: var(--panel-solid); border: 1px solid var(--edge-strong);
  border-radius: 14px; padding: 20px; box-shadow: var(--shadow);
  animation: pop 0.14s ease-out;
}
.modal-card h2 { margin: 0 0 4px; font-size: 16px; }
.modal-sub { margin: 0 0 18px; font-size: 12px; color: var(--ink-faint); line-height: 1.45; }
.modal-error { color: var(--danger); font-size: 12.5px; margin: 0 0 12px; line-height: 1.45; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ================================================================= legend */
.panel {
  position: absolute; z-index: 500;
  background: var(--panel);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 7px 8px 7px 11px;
}
.panel-head h2 { margin: 0; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.panel-body { padding: 0 9px 9px; }
.panel.is-collapsed .panel-body { display: none; }
.panel.is-collapsed #legend-toggle { transform: rotate(-90deg); }

.legend { top: calc(var(--topbar-h) + 10px); left: 12px; width: 194px; }
.legend-head-row, .legend-row {
  display: grid; grid-template-columns: 1fr 24px 28px 28px; gap: 4px; align-items: center;
}
.legend-head-row {
  font-size: 9.5px; color: var(--ink-faint); text-transform: uppercase;
  letter-spacing: 0.04em; padding-bottom: 4px;
}
.legend-head-row span:not(:first-child) { text-align: center; }
.legend-row { padding: 3px 0; border-top: 1px solid rgba(255, 255, 255, 0.05); }
.legend-name { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.legend-name b { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend-name .count { color: var(--ink-faint); font-size: 10.5px; font-style: normal; font-variant-numeric: tabular-nums; }
.legend-row input[type="checkbox"] { width: 14px; height: 14px; margin: 0 auto; accent-color: var(--accent); cursor: pointer; }
.swatch {
  width: 26px; height: 19px; padding: 0; margin: 0 auto; display: block;
  border: 1px solid var(--edge-strong); border-radius: 5px; background: none;
  cursor: pointer; overflow: hidden;
}
.swatch::-webkit-color-swatch-wrapper { padding: 2px; }
.swatch::-webkit-color-swatch { border: none; border-radius: 3px; }
.swatch::-moz-color-swatch { border: none; border-radius: 3px; }

/* ========================================================= zoom (vertical) */
.zoombar {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%); z-index: 500;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 8px 7px;
  background: var(--panel); border: 1px solid var(--edge); border-radius: 11px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.zoom-read {
  font-size: 10px; color: var(--ink-faint); font-variant-numeric: tabular-nums;
  min-height: 12px;
}
#zoom-range {
  writing-mode: vertical-lr;
  direction: rtl;                       /* up = zoom in */
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  width: 18px;
  /* The whole bar - buttons, slider and readout - stays under a third of the
   * window height, so the slider itself gets what is left of that budget. */
  height: min(22vh, 190px);
  background: transparent;
  cursor: pointer;
}
#zoom-range::-webkit-slider-runnable-track {
  width: 4px; border-radius: 3px; background: rgba(255, 255, 255, 0.18);
}
#zoom-range::-moz-range-track { width: 4px; border-radius: 3px; background: rgba(255, 255, 255, 0.18); }
#zoom-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; margin-left: -5px;
  border-radius: 50%; background: #fff; border: none;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.6);
}
#zoom-range::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: #fff; border: none;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.6);
}

/* ============================================================ place panel */
.place-layer { position: absolute; inset: 0; z-index: 600; pointer-events: none; }
.place-panel {
  position: absolute; width: 300px; pointer-events: auto;
  display: flex; flex-direction: column;
  max-height: calc(100vh - var(--topbar-h) - 130px);
  background: var(--panel-solid);
  border: 1px solid var(--edge-strong);
  border-radius: 13px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: pop 0.14s ease-out;
}
@keyframes pop { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
.place-panel.is-dragging { transition: none; cursor: grabbing; user-select: none; }

/* Collapsed: just the header bar, so it can be parked out of the way. */
.place-panel.is-collapsed { max-height: none; }
.place-panel.is-collapsed .panel-body,
.place-panel.is-collapsed .panel-foot { display: none; }
.place-panel.is-collapsed .panel-drag { border-bottom: none; }
.place-panel .p-collapse { transition: transform 0.15s ease; }
.place-panel.is-collapsed .p-collapse { transform: rotate(-90deg); }

.panel-drag { cursor: grab; background: rgba(255, 255, 255, 0.04); border-bottom: 1px solid var(--edge); }
.panel-drag .grip { color: var(--ink-faint); font-size: 13px; letter-spacing: -1px; }
.place-panel .panel-head { padding: 8px 8px 8px 10px; gap: 8px; }
.p-heading {
  margin: 0; flex: 1; font-size: 10.5px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-faint);
}

.place-panel .panel-body {
  padding: 10px; display: grid; gap: 9px;
  overflow-y: auto; min-height: 0;
}
.p-name, .p-notes {
  width: 100%; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--edge);
  border-radius: 8px; padding: 8px 9px; outline: none; font-size: 13px;
  transition: border-color 0.14s;
}
.p-name { font-weight: 600; }
.p-name:focus, .p-notes:focus { border-color: var(--accent); }
.p-name:disabled, .p-notes:disabled { opacity: 0.65; cursor: not-allowed; }
.p-notes { resize: vertical; min-height: 58px; max-height: 160px; line-height: 1.45; }
.p-context {
  margin: -4px 0 0; font-size: 11.5px; color: var(--ink-faint); line-height: 1.4;
}
.p-context:empty, .p-context[hidden] { display: none; }
.p-locked { margin: 0; font-size: 11px; color: var(--ink-faint); line-height: 1.45; }

/* The place ladder: street · district · city · region · country */
.p-levels {
  display: flex; gap: 5px; overflow-x: auto; padding-bottom: 3px;
  scrollbar-width: thin; margin-top: -2px;
}
.p-levels[hidden] { display: none; }
.p-levels.is-busy { opacity: 0.5; pointer-events: none; }
.p-levels::-webkit-scrollbar { height: 4px; }
.p-levels::-webkit-scrollbar-thumb { background: var(--edge-strong); border-radius: 2px; }
.level-chip {
  flex: none; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--edge); background: rgba(255, 255, 255, 0.04);
  color: var(--ink-dim); border-radius: 20px;
  padding: 4px 10px; font-size: 11.5px;
  transition: background 0.13s, color 0.13s, border-color 0.13s;
}
.level-chip:hover { background: rgba(255, 255, 255, 0.11); color: var(--ink); }
.level-chip.is-on {
  background: rgba(91, 157, 255, 0.18); border-color: rgba(91, 157, 255, 0.55);
  color: var(--ink); font-weight: 600;
}

.info {
  border: 1px solid var(--edge); border-radius: 9px; padding: 9px;
  background: rgba(255, 255, 255, 0.03);
}
.info-thumb {
  width: 100%; height: 96px; object-fit: cover; border-radius: 6px;
  margin-bottom: 8px; display: block; background: rgba(255, 255, 255, 0.05);
}
.info-text {
  font-size: 12px; line-height: 1.5; color: var(--ink-dim);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4;
  overflow: hidden;
}
.info-text.is-open {
  display: block; -webkit-line-clamp: unset;
  max-height: 168px; overflow-y: auto;
}
.info-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 7px;
}
.info-loading { margin: 0; font-size: 11.5px; color: var(--ink-faint); font-style: italic; }

.status-row { display: flex; gap: 6px; }
.status-btn {
  flex: 1; border: 1px solid var(--edge); background: rgba(255, 255, 255, 0.04);
  border-radius: 8px; padding: 7px 6px; cursor: pointer; font-size: 12px;
  color: var(--ink-dim); display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all 0.14s;
}
.status-btn .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.status-btn.is-on { color: var(--ink); border-color: var(--edge-strong); background: rgba(255, 255, 255, 0.11); font-weight: 600; }

.panel-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 10px; border-top: 1px solid var(--edge);
  background: rgba(255, 255, 255, 0.02);
}
.saved-flag { font-size: 11px; color: var(--ink-faint); transition: opacity 0.3s; }
.saved-flag.is-on { color: var(--ok); }

/* ============================================================ search dock */
.searchdock {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  z-index: 550; width: min(560px, calc(100vw - 24px));
  display: flex; flex-direction: column; gap: 8px;
}
.search-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: var(--panel); border: 1px solid var(--edge-strong); border-radius: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.search-icon { color: var(--ink-faint); flex: none; }
.search-bar input {
  flex: 1; min-width: 0; background: transparent; border: none; outline: none;
  padding: 3px 0; font-size: 14px;
}
.search-bar input::placeholder { color: var(--ink-faint); }
.search-bar input::-webkit-search-cancel-button { display: none; }

.search-results {
  background: var(--panel); border: 1px solid var(--edge); border-radius: 12px;
  box-shadow: var(--shadow); padding: 5px;
  max-height: 244px; overflow-y: auto;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.search-results.is-expanded { max-height: min(58vh, 460px); }
.search-results[hidden] { display: none; }

.search-status {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 8px 7px; font-size: 11.5px; color: var(--ink-faint); line-height: 1.4;
}
.search-status b { color: var(--ink-dim); font-weight: 600; }
.search-status.is-hint { font-style: italic; }

.result {
  display: flex; align-items: flex-start; gap: 9px; width: 100%;
  padding: 8px 9px; border: none; background: none; border-radius: 9px;
  cursor: pointer; text-align: left; color: inherit;
  transition: background 0.12s;
}
.result:hover { background: rgba(255, 255, 255, 0.06); }
.result.is-active { background: rgba(91, 157, 255, 0.16); }
.result-mark { color: var(--ink-faint); font-size: 12px; line-height: 1.5; flex: none; }
.result-mark.is-wiki { color: #f0b429; }
.result-body { flex: 1; min-width: 0; display: block; }
.result-name { display: block; font-size: 13.5px; font-weight: 560; }
.result-ctx {
  display: block; font-size: 11.5px; color: var(--ink-faint); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.result-kind {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-faint); border: 1px solid var(--edge); border-radius: 5px;
  padding: 2px 5px; flex: none; white-space: nowrap; margin-top: 2px;
}

/* ============================================================ pin marker */
.pin-icon, .crosshair-icon { background: none !important; border: none !important; }
.pin-svg { display: block; overflow: visible; cursor: pointer; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55)); }
.pin-svg .body { transition: transform 0.13s ease; transform-origin: 50% 100%; }
.pin-svg:hover .body { transform: scale(1.16); }
.pin-svg .ring { fill: rgba(255, 255, 255, 0.92); }
.pin-svg .halo { fill: none; stroke: #fff; stroke-width: 2; opacity: 0; }
.pin-svg.is-selected .halo { opacity: 0.85; }
.pin-svg.is-selected .body { transform: scale(1.2); }

/* the "looking at this, not committed" marker */
.crosshair { display: block; overflow: visible; pointer-events: none; }
.crosshair .rim { fill: rgba(91, 157, 255, 0.14); stroke: var(--accent); stroke-width: 2; }
.crosshair .tick { stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }
.crosshair .dot { fill: #fff; }
.crosshair .pulse {
  fill: none; stroke: var(--accent); stroke-width: 1.5;
  transform-origin: 22px 22px; animation: crosspulse 1.9s ease-out infinite;
}
@keyframes crosspulse {
  0% { transform: scale(0.75); opacity: 0.85; }
  100% { transform: scale(1.7); opacity: 0; }
}

/* ================================================================ toasts */
.toasts {
  position: absolute; bottom: 92px; right: 14px; z-index: 700;
  display: grid; gap: 8px; justify-items: end; pointer-events: none;
}
.toast {
  background: var(--panel-solid); border: 1px solid var(--edge-strong);
  border-radius: 10px; padding: 9px 13px; font-size: 12.5px; box-shadow: var(--shadow);
  animation: slidein 0.18s ease-out; max-width: 300px; line-height: 1.45;
}
.toast.is-bad { border-color: rgba(242, 85, 90, 0.5); }
.toast.is-good { border-color: rgba(53, 196, 138, 0.5); }
@keyframes slidein { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

.hint {
  position: absolute; top: calc(var(--topbar-h) + 12px); left: 50%; transform: translateX(-50%);
  z-index: 490; font-size: 11px; color: var(--ink-faint);
  background: rgba(10, 13, 18, 0.72); padding: 5px 12px; border-radius: 20px;
  pointer-events: none; white-space: nowrap; transition: opacity 0.5s;
  max-width: 92vw; overflow: hidden; text-overflow: ellipsis;
}
.hint.is-gone { opacity: 0; }

/* ============================================================ leaflet trim */
.leaflet-container { background: #0d1017; font-family: var(--font); outline: none; }
.leaflet-control-attribution {
  background: rgba(10, 13, 18, 0.72) !important; color: var(--ink-faint) !important;
  font-size: 10px !important; border-radius: 6px 0 0 0;
}
.leaflet-control-attribution a { color: var(--ink-dim) !important; }
.leaflet-tooltip {
  background: var(--panel-solid); border: 1px solid var(--edge-strong); color: var(--ink);
  box-shadow: var(--shadow); border-radius: 7px; padding: 4px 8px; font-size: 12px;
}
.leaflet-tooltip-top::before { border-top-color: var(--edge-strong); }

.globe-tip {
  position: absolute; z-index: 520; pointer-events: none;
  background: var(--panel-solid); border: 1px solid var(--edge-strong);
  border-radius: 7px; padding: 4px 9px; font-size: 12px; box-shadow: var(--shadow);
  transform: translate(-50%, -160%); white-space: nowrap;
}
.globe-tip[hidden] { display: none; }

/* ================================================================= mobile */
@media (max-width: 780px) {
  .legend { width: 172px; }
  .legend-head-row, .legend-row { grid-template-columns: 1fr 22px 26px 26px; }

  .zoombar { top: auto; bottom: 96px; transform: none; padding: 6px 5px; }
  #zoom-range { height: min(16vh, 130px); }

  .searchdock { bottom: 12px; left: 12px; right: 12px; transform: none; width: auto; }
  .search-results { max-height: 200px; }
  .search-results.is-expanded { max-height: 48vh; }

  .place-panel {
    /* Leaves the left rail free for the zoom bar rather than sitting on it. */
    width: calc(100vw - 72px);
    max-height: 46vh;
  }
  .info-thumb { height: 80px; }

  .hint { display: none; }
  .toasts { bottom: 86px; left: 12px; right: 12px; justify-items: stretch; }
  .toast { max-width: none; }
}

@media (max-width: 900px) and (max-height: 560px) {
  .legend { max-height: 42vh; overflow-y: auto; }
  .zoombar { bottom: 86px; }
  #zoom-range { height: 90px; }
  .place-panel { max-height: 60vh; }
}
