:root {
  --paper: #efe3c4;
  --paper-2: #e7d6ae;
  --paper-3: #dcc79a;
  --ink: #2e2016;
  --ink-2: #4a3524;
  --muted: #6e5a44;
  --line: #b89a66;
  --accent: #9c3f2a;
  --accent-2: #7a2f1f;
  --water: #2a4855;
  --serif: "Palatino Linotype", "Book Antiqua", Palatino, "URW Palladio L", "TeX Gyre Pagella", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --panel-w: 348px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--sans); color: var(--ink); background: #cdb487; overflow: hidden; }

#map { position: absolute; inset: 0; background: #cdb487; transition: background-color .3s; }
.leaflet-container { font-family: var(--sans); }
.leaflet-container a { color: var(--accent-2); }

/* ---------- panel */
#panel {
  position: absolute; z-index: 1000; top: 12px; left: 12px; bottom: 12px;
  width: var(--panel-w); max-width: calc(100vw - 24px);
  display: flex; flex-direction: column;
  background: var(--paper);
  background-image: radial-gradient(ellipse at 30% 10%, rgba(255,250,235,.55), transparent 60%),
                    radial-gradient(ellipse at 80% 90%, rgba(160,120,60,.12), transparent 55%);
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(40, 25, 10, .35), inset 0 0 0 4px rgba(255,250,235,.35);
  transition: transform .25s ease, opacity .25s ease;
}
#panel.hidden { transform: translateX(calc(-100% - 24px)); opacity: 0; pointer-events: none; }
.pn-head { position: relative; padding: 16px 44px 12px 18px; border-bottom: 1px double var(--line); }
.pn-kicker { font-family: var(--serif); letter-spacing: .32em; text-transform: uppercase; font-size: 11px; color: var(--muted); }
.pn-head h1 { font-family: var(--serif); font-size: 26px; line-height: 1.1; margin: 4px 0 2px; letter-spacing: .02em; }
.pn-sub { margin: 0; font-family: var(--serif); font-style: italic; color: var(--ink-2); font-size: 15px; }
.icon-btn { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--paper-2); color: var(--ink); font-size: 20px; line-height: 26px; cursor: pointer; }
.icon-btn:hover { background: var(--paper-3); }
.pn-body { overflow-y: auto; padding: 10px 14px 14px; flex: 1; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.pn-sec { margin: 12px 0 4px; }
.pn-sec h2 { font-family: var(--serif); font-size: 13px; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-2);
  margin: 0 0 8px; padding-bottom: 4px; border-bottom: 1px solid rgba(184,154,102,.6); display: flex; align-items: baseline; gap: 8px; }
.h-actions { margin-left: auto; letter-spacing: 0; text-transform: none; font-family: var(--sans); font-size: 12px; }
.pn-search input { width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); background: #fbf5e6;
  font: 15px var(--serif); color: var(--ink); }
.pn-search input:focus, .dlg input:focus, .dlg textarea:focus, .dlg select:focus { outline: 2px solid rgba(156,63,42,.45); outline-offset: 1px; }

.preset-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #f7eed7; border-radius: 999px; padding: 5px 10px; font-size: 12.5px; cursor: pointer; color: var(--ink); }
.chip:hover { background: var(--paper-3); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.radio-list label, .layer-row { display: flex; align-items: center; gap: 8px; padding: 4px 4px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.radio-list label:hover, .layer-row:hover { background: rgba(255,250,235,.55); }
.radio-list input, .layer-row input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; flex: none; }
.layer-row { flex-wrap: wrap; }
.layer-row .name { flex: 1; min-width: 0; }
.layer-row .swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.25); flex: none; }
.layer-row input[type=range] { width: 76px; accent-color: var(--accent); flex: none; }
.layer-row.off .name { color: var(--muted); }
.layer-row .zoomhint { font-size: 11px; color: var(--muted); font-style: italic; }

.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }
.btn { border: 1px solid var(--ink); background: var(--ink); color: var(--paper); border-radius: 8px; padding: 7px 11px;
  font-size: 13.5px; cursor: pointer; }
.btn:hover { background: #4a3524; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-2); cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 2px; }
.pn-links { font-size: 13px; line-height: 1.9; }
.pn-links a { color: var(--accent-2); }
.hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; line-height: 1.4; }

.user-list { margin-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.user-row { display: flex; align-items: center; gap: 6px; padding: 4px; border-radius: 6px; font-size: 13.5px; }
.user-row:hover { background: rgba(255,250,235,.55); }
.user-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row input[type=range] { width: 64px; accent-color: var(--accent); }
.mini { border: 1px solid var(--line); background: #f7eed7; border-radius: 6px; font-size: 12px; padding: 2px 6px; cursor: pointer; color: var(--ink); }
.mini:hover { background: var(--paper-3); }

.fab { position: absolute; z-index: 999; top: 12px; left: 12px; border: 1px solid var(--line); background: var(--paper);
  color: var(--ink); border-radius: 999px; padding: 9px 14px; font: 14px var(--serif); cursor: pointer;
  box-shadow: 0 6px 18px rgba(40,25,10,.3); display: none; }
.fab.show { display: block; }

.coords { position: absolute; z-index: 800; left: 50%; transform: translateX(-50%); bottom: 8px; padding: 3px 10px; border-radius: 6px;
  background: rgba(239,227,196,.9); border: 1px solid var(--line); font: 12.5px var(--serif); color: var(--ink); pointer-events: none;
  white-space: nowrap; }
.coords:empty { display: none; }
.toast { position: absolute; z-index: 1200; left: 50%; top: 14px; transform: translateX(-50%) translateY(-20px); opacity: 0;
  background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 8px; font-size: 14px; transition: all .25s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- dialogi */
.dlg { border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); padding: 18px 20px;
  width: min(420px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(30,20,10,.45); }
.dlg.wide { width: min(720px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(40, 28, 16, .45); }
.dlg h3 { font-family: var(--serif); margin: 0 0 12px; font-size: 21px; }
.dlg h4 { font-family: var(--serif); margin: 14px 0 6px; font-size: 16px; }
.dlg p, .dlg li { font-size: 14px; line-height: 1.5; }
.dlg label { display: block; font-size: 13px; color: var(--ink-2); margin: 8px 0; }
.dlg label.inline { display: flex; align-items: center; gap: 10px; }
.dlg input[type=text], .dlg input[type=url], .dlg textarea, .dlg select { display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fbf5e6; font: 14px var(--sans); color: var(--ink); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.legend-img { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); }

/* ---------- napisy dynamiczne */
.lbl { font-family: var(--serif); color: #241810; white-space: nowrap; pointer-events: none; line-height: 1;
  text-shadow: 0 0 2px #f4ead0, 0 0 2px #f4ead0, 0 0 4px #f4ead0, 0 0 7px rgba(244,234,208,.9); }
.lbl span { display: inline-block; }
.lbl-r1 { font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.lbl-r2 { font-weight: 700; }
.lbl-r3 { font-style: italic; color: #34251a; }
.lbl-peak { font-style: italic; color: #4b3420; line-height: 1.05; }
.lbl-peak small { display: block; font-style: normal; font-size: 82%; }
.lbl-mon { font-style: italic; color: #4b3420; }
.lbl-reg { color: rgba(106, 74, 44, .82); text-transform: uppercase; }
.lbl-ridge { color: rgba(106, 74, 44, .82); font-style: italic; }
.lbl-reg span, .lbl-ridge span { transform-origin: 50% 50%; }
.peak-mark { width: 14px; height: 12px; }
.peak-mark svg { display: block; }
.dark-bg .lbl { text-shadow: 0 0 2px #f4ead0, 0 0 3px #f4ead0, 0 0 5px #f4ead0, 0 0 9px #f4ead0, 0 0 12px rgba(244,234,208,.95); }

/* nazwy rzek (SVG) */
.river-text { font-family: var(--serif); font-style: italic; }

/* zabytki — obszary klikalne */
.mon-hit { cursor: pointer; }
.leaflet-popup-content-wrapper { background: var(--paper); color: var(--ink); border-radius: 10px; border: 1px solid var(--line); }
.leaflet-popup-tip { background: var(--paper); }
.leaflet-popup-content { font-size: 14px; line-height: 1.45; margin: 12px 16px; }
.pop h4 { font-family: var(--serif); font-size: 17px; margin: 0 0 4px; }
.pop .meta { color: var(--muted); font-size: 12px; margin-top: 6px; }
.pop table { border-collapse: collapse; font-size: 12.5px; margin-top: 4px; }
.pop td { padding: 1px 6px 1px 0; vertical-align: top; }
.pop td:first-child { color: var(--muted); }

.pulse { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--accent); box-shadow: 0 0 0 0 rgba(156,63,42,.6);
  animation: pulse 1.4s ease-out 3; background: rgba(156,63,42,.15); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(156,63,42,.6);} 100% { box-shadow: 0 0 0 26px rgba(156,63,42,0);} }

.grid-lbl { font: 11px var(--serif); color: #5a3a1f; text-shadow: 0 0 3px #f4ead0, 0 0 3px #f4ead0; white-space: nowrap; pointer-events: none; }

.user-pin svg { display: block; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }

@media (max-width: 720px) {
  :root { --panel-w: 320px; }
  #panel { top: 8px; left: 8px; bottom: 8px; }
  .coords { display: none; }
  .fab { top: 8px; left: 8px; }
}
