html, body { margin: 0; height: 100%; font: 14px/1.4 system-ui, sans-serif; color: #1a1a1a; background: #e5e3df; }
#map { position: absolute; inset: 0; }
.map-page #map { top: var(--nav-h, 0px); }
#map:focus-visible { outline: 3px solid #1565c0; outline-offset: -3px; }

#panel {
  position: absolute; top: calc(var(--nav-h, 0px) + 10px); left: 54px; z-index: 1000;
  width: 310px; max-width: calc(100vw - 80px); max-height: calc(100vh - var(--nav-h, 0px) - 40px); overflow: auto;
  background: #fff; border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .25); padding: 12px 14px;
}
#panel h1 { font-size: 16px; margin: 0; color: #1b5e20; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
#panel-toggle {
  flex: 0 0 auto; width: 32px; height: 32px; padding: 0; border: 1px solid #767676; border-radius: 4px;
  background: #f7f7f7; cursor: pointer; display: grid; place-items: center;
}
#panel-toggle:hover { background: #e9f3ea; }
#panel-toggle .chevron {
  width: 8px; height: 8px; border-right: 2px solid #1a1a1a; border-bottom: 2px solid #1a1a1a;
  transform: translateY(2px) rotate(-135deg);
}
#panel-toggle[aria-expanded="false"] .chevron { transform: translateY(-2px) rotate(45deg); }
#panel.collapsed #panel-body { display: none; }
#panel.collapsed .panel-head { margin-bottom: 0; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
#panel .src { margin: 0 0 10px; font-size: 12px; color: #555; }
#panel a { color: #0d47a1; }

fieldset { border: 0; margin: 0; padding: 0; }
legend { font-weight: 600; font-size: 13px; padding: 0 0 2px; }

#legend { list-style: none; margin: 0; padding: 0; }
#legend li { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; border-top: 1px solid #eee; }
#legend input { margin-top: 3px; width: 16px; height: 16px; }
#legend .swatch { flex: 0 0 18px; height: 14px; margin-top: 2px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .5); }
#legend .text { flex: 1; cursor: pointer; }
#legend .swatch-loziska { background: rgba(183, 28, 28, .12); border: 2px dashed; }
#legend .swatch-dp { background: rgba(78, 52, 46, .1); border: 2px dotted; }
#legend .swatch-lokality, #legend .swatch-vrty {
  flex-basis: 14px; width: 14px; height: 14px; margin: 2px 2px 0;
  border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5);
}
#legend .code { font-weight: 600; }
#legend .count { color: #595959; font-size: 12px; }

.actions { display: flex; gap: 6px; margin-top: 10px; }
.actions button {
  flex: 1; min-height: 32px; padding: 5px; font: inherit;
  border: 1px solid #767676; border-radius: 4px; background: #f7f7f7; color: #1a1a1a; cursor: pointer;
}
.actions button:hover { background: #e9f3ea; }
.actions button[aria-pressed="true"] { background: #1565c0; border-color: #1565c0; color: #fff; }
.actions button[aria-busy="true"] { cursor: progress; opacity: .7; }
:focus-visible { outline: 3px solid #1565c0; outline-offset: 2px; }

.status { margin: 8px 0 0; font-size: 12px; min-height: 1em; }
.status:empty { display: none; }
#panel .build { margin: 10px 0 0; font-size: 11px; color: #595959; }
.opacity { display: block; margin-top: 10px; font-size: 12px; color: #444; }
#opacity { width: 100%; }

/* moje poloha: tečka + šipka směru (otáčí se celý .me-arrow kolem středu ikony) */
.me-dot {
  position: absolute; left: 9px; top: 9px; width: 18px; height: 18px; box-sizing: border-box;
  border-radius: 50%; background: #1565c0; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35);
}
.me-arrow { position: absolute; inset: 0; display: none; }
.me-arrow.on { display: block; }
.me-arrow::before {
  content: ""; position: absolute; left: 11px; top: 0;
  border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 12px solid #1565c0;
}

.popup h2 { margin: 0 0 6px; font-size: 14px; }
.popup table { border-collapse: collapse; font-size: 12px; }
.popup th, .popup td { padding: 1px 6px 1px 0; vertical-align: top; text-align: left; }
.popup th { color: #595959; font-weight: normal; white-space: nowrap; }
.popup .note { margin: 6px 0 0; font-size: 12px; color: #595959; }
.popup + .parcel { margin-top: 8px; padding-top: 6px; border-top: 1px solid #ddd; }
.lpis-legend { margin: 10px 0 0; font-size: 12px; }
.lpis-legend img { display: block; max-width: 100%; margin-top: 4px; }

.noscript { position: absolute; top: 50%; width: 100%; text-align: center; }

@media (max-width: 600px) {
  #panel {
    top: auto; bottom: 24px; left: 8px; right: 8px; width: auto; max-width: none;
    max-height: 55vh;
    padding: 8px 10px; font-size: 13px;
  }
  #panel h1 { font-size: 15px; }
  #panel .src { font-size: 11px; }
  #legend li { padding: 3px 0; }
  #legend .count { display: none; }
  .actions { margin-top: 6px; }
  #panel.collapsed .actions { margin-top: 6px; }
  /* panel je dole a rozbaluje se nahoru -> šipky obráceně */
  #panel-toggle .chevron { transform: translateY(-2px) rotate(45deg); }
  #panel-toggle[aria-expanded="false"] .chevron { transform: translateY(2px) rotate(-135deg); }
}
