.gl-widget {
  --gl-bg: #0f1417;
  --gl-panel: #161d22;
  --gl-panel-2: #1b2329;
  --gl-border: #26313a;
  --gl-text: #dce4e8;
  --gl-muted: #7a8a93;
  --gl-accent: #4ce8a0;
  --gl-accent-dim: #245c48;
  --gl-amber: #e8a33d;
  --gl-amber-dim: #5c4622;
  --gl-height: 620px;

  box-sizing: border-box;
  position: relative;
  width: 100%;
  height: var(--gl-height);
  max-width: 100%;
  background: var(--gl-bg);
  border: 1px solid var(--gl-border);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: row;
  font-family: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  color: var(--gl-text);
}
.gl-widget *,
.gl-widget *::before,
.gl-widget *::after { box-sizing: border-box; }

/* Map fills remaining space; panel is fixed-width alongside it */
.gl-map {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: #0b0f11;
}
.leaflet-container.gl-leaflet-instance { background: #0b0f11; }

.gl-panel {
  width: 300px;
  flex: 0 0 300px;
  height: 100%;
  overflow-y: auto;
  background: var(--gl-panel);
  border-left: 1px solid var(--gl-border);
  display: flex;
  flex-direction: column;
}

.gl-block { padding: 14px 16px; border-bottom: 1px solid var(--gl-border); }
.gl-block:last-child { border-bottom: none; }

.gl-title { font-size: 14px; font-weight: 600; margin: 0; letter-spacing: 0.02em; color: var(--gl-text); }
.gl-title span { color: var(--gl-accent); }
.gl-sub { font-size: 11.5px; color: var(--gl-muted); margin-top: 4px; line-height: 1.5; }

.gl-readout-locator {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--gl-accent);
  margin: 2px 0 8px 0;
  word-break: break-all;
}
.gl-coord-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 3px 0; }
.gl-coord-row .gl-k { color: var(--gl-muted); }

.gl-field-label { display: block; font-size: 11px; color: var(--gl-muted); margin-bottom: 5px; }

.gl-search-row { display: flex; gap: 6px; }
.gl-search-input {
  flex: 1;
  min-width: 0;
  background: var(--gl-panel-2);
  border: 1px solid var(--gl-border);
  color: var(--gl-text);
  font-family: inherit;
  /* 16px avoids iOS Safari auto-zoom on focus */
  font-size: 16px;
  padding: 9px 9px;
  border-radius: 3px;
}
.gl-search-input:focus {
  outline: 2px solid var(--gl-accent);
  outline-offset: 1px;
  border-color: var(--gl-accent);
}
.gl-search-input::placeholder { color: var(--gl-muted); }

.gl-btn {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: 3px;
  border: 1px solid var(--gl-border);
  background: var(--gl-panel-2);
  color: var(--gl-text);
  padding: 10px 12px;
  min-height: 40px;
  cursor: pointer;
}
.gl-btn:hover { border-color: var(--gl-accent); }
.gl-btn:focus-visible { outline: 2px solid var(--gl-accent); outline-offset: 1px; }
.gl-btn-primary { background: var(--gl-accent-dim); border-color: var(--gl-accent); color: var(--gl-accent); }
.gl-btn-full { width: 100%; }
.gl-btn.gl-active { background: var(--gl-amber-dim); border-color: var(--gl-amber); color: var(--gl-amber); }
.gl-btn-row { display: flex; gap: 6px; margin-top: 8px; }

.gl-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  padding: 7px 0;
  cursor: pointer;
}
.gl-toggle-row input { accent-color: var(--gl-accent); width: 16px; height: 16px; }

.gl-ruler-result { margin-top: 10px; font-size: 12px; line-height: 1.7; display: none; }
.gl-ruler-result.gl-show { display: block; }
.gl-ruler-result .gl-k { color: var(--gl-muted); }
.gl-ruler-result .gl-v { color: var(--gl-amber); font-weight: 600; }

.gl-hint { font-size: 11px; color: var(--gl-muted); margin-top: 8px; line-height: 1.5; }

.gl-grid-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: #4ce8a0;
  opacity: 0.55;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 0 3px #0b0f11, 0 0 3px #0b0f11;
}
.gl-grid-label.gl-sq { font-size: 9px; opacity: 0.45; }

.gl-pin-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: #0f1417;
  background: var(--gl-accent);
  padding: 3px 7px;
  border-radius: 3px;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/*
  Layout collapse is driven by the WIDGET'S OWN width (via a JS
  ResizeObserver toggling this class), not a viewport media query.
  The widget can be embedded in a narrow sidebar column on a wide
  desktop, or fill a full-width column on a phone — container width
  is what actually determines whether the two-pane layout fits.
*/
.gl-widget.gl-narrow {
  flex-direction: column;
  height: auto;
}
.gl-widget.gl-narrow .gl-map {
  flex: 0 0 340px;
  width: 100%;
  height: 340px;
}
.gl-widget.gl-narrow .gl-panel {
  width: 100%;
  flex: 1 1 auto;
  height: auto;
  max-height: 360px;
  border-left: none;
  border-top: 1px solid var(--gl-border);
}

@media (prefers-reduced-motion: reduce) {
  .gl-widget * { transition: none !important; animation: none !important; }
}
