:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #1d211d;
  --muted: #696d67;
  --paper: rgba(249, 248, 242, 0.96);
  --line: rgba(29, 33, 29, 0.13);
  --accent: #216e4e;
  --shadow: 0 14px 44px rgba(30, 35, 30, 0.2);
}

* { box-sizing: border-box; }
html, body, #map { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { color: var(--ink); background: #dde4df; }
button, select { font: inherit; }

.brand {
  position: fixed;
  z-index: 4;
  top: max(14px, env(safe-area-inset-top));
  left: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px 0 6px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: 0 5px 20px rgba(30, 35, 30, 0.14);
  backdrop-filter: blur(14px);
  font-size: 14px;
  font-weight: 720;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  color: white;
  background: var(--accent);
  font-family: Georgia, serif;
  font-size: 17px;
}
.status { color: var(--muted); font-size: 11px; font-weight: 550; }

.picker {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  width: min(520px, calc(100vw - 24px));
  transform: translateX(-50%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.picker-handle {
  display: grid;
  grid-template-columns: 25px 1fr 25px;
  align-items: center;
  width: 100%;
  min-height: 54px;
  padding: 8px 16px;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-weight: 730;
  text-align: center;
}
.grabber { width: 24px; height: 4px; border-radius: 3px; background: #afb2ad; }
.chevron { color: var(--muted); font-size: 19px; transition: transform 140ms ease; }
.picker.collapsed .chevron { transform: rotate(180deg); }
.picker.collapsed .picker-body { display: none; }
.picker-body { max-height: min(56vh, 480px); padding: 0 16px 17px; overflow: auto; }
.field-label, .section-title {
  display: block;
  margin: 5px 0 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.view-select {
  width: 100%;
  min-height: 44px;
  padding: 0 38px 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  font-weight: 650;
}
.description { margin: 11px 2px 15px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.layers { display: grid; gap: 7px; }
.layer-toggle {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 43px;
  padding: 8px 10px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  font-weight: 650;
}
.layer-toggle input { width: 20px; height: 20px; accent-color: var(--accent); }
.attribution { margin: 13px 2px 0; color: var(--muted); font-size: 10px; line-height: 1.35; }

.feature {
  position: fixed;
  z-index: 6;
  right: 14px;
  top: max(66px, calc(env(safe-area-inset-top) + 58px));
  width: min(340px, calc(100vw - 28px));
  max-height: 48vh;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.feature h2 { margin: 0 32px 12px 0; font-size: 16px; }
.feature-close { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 25px; color: var(--muted); }
.feature dl { display: grid; grid-template-columns: minmax(80px, 0.7fr) minmax(100px, 1.3fr); gap: 0; margin: 0; font-size: 12px; }
.feature dt, .feature dd { margin: 0; padding: 7px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.feature dt { color: var(--muted); padding-right: 10px; }

.empty {
  position: fixed;
  z-index: 5;
  left: 50%;
  top: 50%;
  width: min(430px, calc(100vw - 32px));
  transform: translate(-50%, -50%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: var(--shadow);
  text-align: center;
}
.empty h1 { margin: 0 0 8px; font-size: 22px; }
.empty p { margin: 0; color: var(--muted); line-height: 1.5; }
.empty code { font-size: 12px; }

.maplibregl-ctrl-top-right { top: max(58px, calc(env(safe-area-inset-top) + 46px)); right: 5px; }
.maplibregl-ctrl-group { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 4px 18px rgba(30, 35, 30, 0.14) !important; }
.maplibregl-ctrl-attrib { font-size: 9px; }

@media (max-width: 640px) {
  .picker { bottom: max(8px, env(safe-area-inset-bottom)); width: calc(100vw - 16px); border-radius: 21px; }
  .picker-body { max-height: 52vh; }
  .feature { top: auto; right: 8px; bottom: calc(max(8px, env(safe-area-inset-bottom)) + 66px); width: calc(100vw - 16px); max-height: 42vh; }
}
