/* Layout: seznam vlevo, plán s posunem a zoomem vpravo; na telefonu plán nahoře a seznam pod ním. */
:root{
  --bg:#ecefec; --panel:#f8f9f7; --ink:#1b2420; --muted:#5b6862; --line:#d3d9d4;
  --accent:#0b57d0; --accent-ink:#ffffff; --grave:#b3262d; --mon:#d4692f; --new:#17708e; --map-bg:#3c342f; --chip:#e3e8e4;
  --font-ui:"IBM Plex Sans Condensed","Arial Narrow",system-ui,sans-serif;
  --font-name:"Newsreader",Georgia,"Times New Roman",serif;
}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){
  --bg:#121715; --panel:#1b221f; --ink:#e8eee9; --muted:#9aa8a1; --line:#2d3732; --accent:#7aa7ff; --accent-ink:#0b1220; --grave:#ec6a70; --mon:#f09a68; --new:#4fb3d3; --map-bg:#2b2521; --chip:#26302c; color-scheme:dark}}
:root[data-theme="dark"]{
  --bg:#121715; --panel:#1b221f; --ink:#e8eee9; --muted:#9aa8a1; --line:#2d3732; --accent:#7aa7ff; --accent-ink:#0b1220; --grave:#ec6a70; --mon:#f09a68; --new:#4fb3d3; --map-bg:#2b2521; --chip:#26302c; color-scheme:dark}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--font-ui);font-size:15px;line-height:1.35}
.app{height:100%;display:grid;grid-template-columns:minmax(300px,380px) 1fr;gap:0;padding-inline:0}
aside{display:flex;flex-direction:column;min-height:0;min-width:0;background:var(--panel);border-right:1px solid var(--line)}
.head{padding:14px 16px 10px;display:flex;flex-direction:column;gap:10px}
h1{margin:0;font-family:var(--font-name);font-weight:600;font-size:22px;line-height:1.15;text-wrap:balance}
.sub{margin:0;color:var(--muted);font-size:13px}
.search{width:100%;padding:10px 12px;border:1px solid var(--line);border-radius:6px;background:var(--bg);color:var(--ink);font:inherit}
.search:focus-visible,button:focus-visible,a:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.tabs{display:flex;gap:6px}
.tab{flex:1;padding:8px 6px;border:1px solid var(--line);background:var(--chip);color:var(--ink);font:inherit;cursor:pointer;border-radius:6px;display:flex;align-items:center;justify-content:center;gap:7px}
.tab[aria-pressed="true"]{background:var(--ink);color:var(--panel);border-color:var(--ink)}
.dot{width:11px;height:11px;border-radius:50%;background:var(--grave);display:inline-block}
.dot.sq{border-radius:2px;background:var(--mon)}
.hint{font-size:12.5px;color:var(--muted);min-height:1.2em}
ul.list{list-style:none;margin:0;padding:0;overflow:auto;flex:1;min-height:0;border-top:1px solid var(--line)}
.row{border-bottom:1px solid var(--line)}
.row[aria-current="true"]{background:var(--chip);box-shadow:inset 3px 0 0 var(--accent)}
.rlinks{display:flex;flex-wrap:wrap;gap:6px;padding:0 16px 10px 60px}
.rlinks a,.rlinks button{padding:3px 9px;border:1px solid var(--accent);border-radius:5px;background:transparent;color:var(--accent);font:inherit;font-size:13px;text-decoration:none;cursor:pointer}
.rlinks .onmap{background:var(--accent);color:var(--accent-ink)}
.item{display:grid;grid-template-columns:34px 1fr;gap:10px;align-items:start;width:100%;text-align:left;padding:9px 16px 6px;border:0;background:transparent;color:var(--ink);font:inherit;cursor:pointer}
.item:hover{background:var(--chip)}
.num{font-variant-numeric:tabular-nums;font-weight:600;font-size:13px;min-width:30px;height:26px;display:grid;place-items:center;color:#fff;background:var(--grave);border-radius:50%}
.num.sq{background:var(--mon);border-radius:4px}
.num.nd{background:var(--new);border-radius:3px;transform:rotate(45deg) scale(.86)}
.num.nd>b{transform:rotate(-45deg);font-weight:600}
.num.nx{background:transparent;color:var(--muted);border:1.5px dashed var(--muted)}
.dot.nd{border-radius:1px;background:var(--new);transform:rotate(45deg)}
.unk{color:var(--muted);font-style:italic}
.iname{font-family:var(--font-name);font-size:16.5px;line-height:1.2}
.imeta{color:var(--muted);font-size:12.5px;font-variant-numeric:tabular-nums}
main{position:relative;min-width:0;min-height:0;background:var(--map-bg);overflow:hidden}
#vp{position:absolute;inset:0;touch-action:none;cursor:grab;overflow:hidden}
#vp.drag{cursor:grabbing}
#layer{position:absolute;left:0;top:0;transform-origin:0 0}
#layer>svg{display:block}
#layer img{display:block;max-width:none;user-select:none;-webkit-user-drag:none}
.hs{position:absolute;width:30px;height:30px;margin:-15px 0 0 -15px;border-radius:50%;background:transparent;border:0;padding:0;cursor:pointer}
.hs.sq{border-radius:5px}
.hs:hover{box-shadow:0 0 0 3px #fff,0 0 0 6px var(--accent)}
.hs:focus-visible{outline:3px solid var(--accent)}
.ring{position:absolute;width:46px;height:46px;margin:-23px 0 0 -23px;border-radius:50%;border:4px solid #0b57d0;box-shadow:0 0 0 3px #fff,0 0 0 9px rgba(11,87,208,.35);pointer-events:none;animation:pulse 1.6s ease-in-out infinite}
.ring.sq{border-radius:9px}
.mring{position:absolute;width:40px;height:40px;margin:-20px 0 0 -20px;border-radius:50%;border:3px solid #0b57d0;box-shadow:0 0 0 3px #fff;pointer-events:none}
.mring.sq{border-radius:8px}
.tag{display:inline-block;margin-left:6px;padding:0 6px;border-radius:3px;background:var(--chip);color:var(--muted);font-size:11.5px}
@keyframes pulse{50%{transform:scale(1.18)}}
@media (prefers-reduced-motion:reduce){.ring{animation:none}}
#geomap{display:block}
.me{position:absolute;width:22px;height:22px;margin:-11px 0 0 -11px;border-radius:50%;background:#1a73e8;border:4px solid #fff;box-shadow:0 0 0 2px #1a73e8,0 2px 8px rgba(0,0,0,.4);pointer-events:none;z-index:2}
.meacc{position:absolute;border-radius:50%;background:rgba(26,115,232,.15);border:1.5px solid rgba(26,115,232,.5);pointer-events:none}
.toast{position:absolute;left:50%;transform:translateX(-50%);top:60px;z-index:5;max-width:min(360px,calc(100% - 24px));background:var(--panel);color:var(--ink);border:1px solid var(--line);border-radius:8px;padding:10px 12px;font-size:13.5px;box-shadow:0 6px 20px rgba(0,0,0,.3)}
.toast a{color:var(--accent)}
.zoom{position:absolute;right:12px;top:12px;display:flex;flex-direction:column;gap:6px;z-index:3}
.zoom button{width:40px;height:40px;border-radius:6px;border:1px solid var(--line);background:var(--panel);color:var(--ink);font-size:20px;cursor:pointer}
.card{position:absolute;left:12px;bottom:12px;width:min(400px,calc(100% - 24px));max-height:calc(100% - 24px);overflow:auto;background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:14px 16px;z-index:4;box-shadow:0 8px 28px rgba(0,0,0,.35)}
.card[hidden]{display:none}
.card .top{display:flex;gap:12px;align-items:flex-start}
.card h2{margin:0;font-family:var(--font-name);font-size:22px;line-height:1.15;text-wrap:balance}
.card .yrs{color:var(--muted);font-variant-numeric:tabular-nums;margin-top:2px}
.card p{margin:10px 0 0}
.loc{margin-top:10px;display:flex;flex-wrap:wrap;gap:6px}
.chip{background:var(--chip);border-radius:4px;padding:3px 8px;font-size:13px;font-variant-numeric:tabular-nums}
.links{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.links a{padding:7px 11px;border-radius:6px;border:1px solid var(--accent);color:var(--accent);text-decoration:none;font-size:14px}
.links a.pri{background:var(--accent);color:var(--accent-ink)}
.close{margin-left:auto;border:0;background:transparent;color:var(--muted);font-size:22px;line-height:1;cursor:pointer;padding:2px 6px}
.note{font-size:12px;color:var(--muted);margin-top:10px}
.themebtn{align-self:flex-start;border:0;background:transparent;color:var(--muted);font:inherit;font-size:12.5px;cursor:pointer;padding:0;text-decoration:underline}
/* Phone: full-screen map, bottom sheet (#sheet) with search, filters, list and card. */
.grabrow{display:none}
.sheethead{display:none}
.sheetbody{display:contents}
.head{padding-top:14px}
#cardslot:empty{display:none}
:root{--sheet-h:calc(132px + env(safe-area-inset-bottom))}
@media (max-width:760px){
  html,body{overflow:hidden;overscroll-behavior:none}
  html[data-sheet="peek"]{--sheet-h:calc(132px + env(safe-area-inset-bottom))}
  html[data-sheet="half"]{--sheet-h:50vh;--sheet-h:50dvh}
  html[data-sheet="full"]{--sheet-h:calc(100vh - 56px);--sheet-h:calc(100dvh - 56px)}
  .app{display:block;height:100vh;height:100dvh}
  main{position:fixed;inset:0}
  #sheet{position:fixed;left:0;right:0;bottom:0;z-index:10;height:var(--sheet-h);border:0;border-top:1px solid var(--line);border-radius:16px 16px 0 0;box-shadow:0 -4px 20px rgba(0,0,0,.28);padding-bottom:env(safe-area-inset-bottom);transition:height .25s ease;overflow:hidden}
  .grabrow{display:block;flex:none}
  .grab{display:flex;align-items:center;justify-content:center;width:100%;height:44px;padding:0;border:0;background:transparent;cursor:grab;touch-action:none}
  .grab span{width:44px;height:5px;border-radius:3px;background:var(--muted);opacity:.6}
  .sheethead{display:block;flex:none;padding:0 12px 8px}
  .head h1{display:none}
  .search{min-height:48px;font-size:16px}
  .sheetbody{display:block;flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
  .head{padding:10px 12px 8px;gap:8px}
  .sub{display:none}
  ul.list{overflow:visible;flex:none}
  .item{padding:12px 16px 8px;min-height:48px}
  .rlinks a,.rlinks button{padding:9px 12px;min-height:44px}
  .tab,.obor,.cemsel,.glabel{min-height:44px}
  .legend summary{padding:10px 0}
  .card{position:static;width:auto;max-height:none;margin:0 12px 8px;padding:12px;box-shadow:none;border-color:var(--line)}
  .card .note{display:none}.card h2{font-size:21px}.card p{margin-top:6px}.links{margin-top:8px}
  .links a{display:inline-flex;align-items:center;min-height:44px;padding:8px 14px}
  .close{min-width:44px;min-height:44px;font-size:26px}
  .fixbtn{min-height:48px}
  .zoom{right:12px;top:auto;bottom:calc(var(--sheet-h) + 12px);gap:10px;align-items:flex-end;transition:bottom .25s ease}
  html[data-sheet="full"] .zoom{visibility:hidden}
  .zoom button{width:48px;height:48px;border-radius:10px;box-shadow:0 2px 8px rgba(0,0,0,.3)}
  .zoom #loc{width:56px;height:56px;border-radius:14px;background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
  .zoom #loc svg{width:26px;height:26px}
  .toast{top:calc(env(safe-area-inset-top) + 12px)}
  /* Taps on the map are resolved to the nearest marker in JS; the buttons stay for keyboard and screen readers. */
  .hs{width:44px;height:44px;margin:-22px 0 0 -22px;pointer-events:none}
  body{padding-inline:0}
}
@media (max-width:760px) and (prefers-reduced-motion:reduce){#sheet,.zoom{transition:none}}
.srcl{color:var(--accent);white-space:nowrap}
.card.src ul{margin:8px 0 0;padding-left:18px;font-size:13.5px;line-height:1.45}.card.src li{margin:5px 0}.card.src a{color:var(--accent)}.card.src .lic{color:var(--muted);font-size:12px}

.tabs{flex-wrap:wrap}.tab{font-size:14px;padding:7px 5px;gap:5px;min-width:calc(50% - 3px)}.dot.nm{background:#2f7d4f;border-radius:50%;box-shadow:0 0 0 2px #f3e4b0 inset}
.num.nm{background:#2f7d4f}.num.na{background:#6b3fa0;border-radius:8px}.num.na.off{background:#b9aac9}.dot.na{background:#6b3fa0;border-radius:3px}.tabs .tab{min-width:calc(33% - 4px)}.tab .dot{flex-shrink:0}
#geomap.filt .mk{display:none}#geomap.filt.f-g .mk.c-g{display:inline}#geomap.filt.f-s .mk.c-s{display:inline}#geomap.filt.f-n .mk.c-n{display:inline}#geomap.filt.f-m .mk.c-m{display:inline}#geomap.filt.f-a .mk.c-a{display:inline}.allmap{display:flex;align-items:center;gap:6px;font-size:13px;color:var(--muted);margin-top:8px;cursor:pointer}
.tag.ad{background:#6b3fa0;color:#fff}
.fgroup{margin-top:8px}.fgroup .tabs{display:grid;grid-template-columns:1fr 1fr;gap:6px}.fgroup .tab{min-width:0;white-space:nowrap}.fgroup .tabs:has(> :only-child){grid-template-columns:1fr}.glabel{display:block;background:none;border:0;padding:0 0 4px;font:inherit;font-size:12.5px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--muted);cursor:pointer}.glabel[aria-pressed="true"]{color:var(--ink)}
#geomap .mk.selk{display:inline!important}
.lb{display:inline-flex;align-items:center;gap:6px}
@media (max-width:480px){.fgroup .tab{flex-direction:column;gap:1px;padding:6px 4px;line-height:1.15}.fgroup .tab .cnt{font-size:11.5px;opacity:.75}}
.cats{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px}.cats span{font-size:11.5px;padding:1px 7px;border-radius:10px;background:var(--chip);color:var(--ink);border:1px solid var(--line)}.mcat{color:var(--accent)}
.oborl{display:block;font-size:12.5px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--muted);padding-bottom:4px}.obor{width:100%;padding:8px 10px;border:1px solid var(--line);border-radius:6px;background:var(--chip);color:var(--ink);font:inherit;font-size:14px}
#geomap .mk.apx circle,#geomap .mk.apx path,#geomap .mk.apx rect{stroke-dasharray:4 3;stroke:#fff;stroke-width:2;fill-opacity:.72}
.num.nm.off{background:#9fbfaa}
.vb{display:inline-flex;align-items:center;justify-content:center;min-width:16px;height:16px;padding:0 3px;margin-left:5px;border-radius:8px;font-size:11px;font-weight:700;line-height:1;vertical-align:1px;color:#fff}.v-v{background:#2f7d4f}.v-p{background:#7a8a2a}.v-u{background:#c07a12}.v-x{background:#b3262d}.wv{margin-top:10px;font-size:13px;line-height:1.4;color:var(--muted)}.wvh{font-weight:600;color:var(--ink);margin-bottom:3px}.wvl{display:flex;gap:6px;align-items:flex-start;margin:3px 0}.wvl .vb{margin:2px 0 0;flex:none}
.legend{margin-top:8px;font-size:13px;color:var(--muted)}.legend summary{cursor:pointer;color:var(--accent)}.legend ul{margin:6px 0 0;padding-left:2px;list-style:none}.legend li{margin:4px 0;line-height:1.35}.legend .dot{margin-right:6px;vertical-align:middle}.legend .dot.nd{display:inline-block}

/* Photos, contributors, correction button, cemetery select */
.gallery{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.gphoto{margin:0;flex:1 1 140px;max-width:100%}
.gphoto img{width:100%;height:auto;border-radius:6px;display:block}
.gphoto figcaption{font-size:12px;color:var(--muted);margin-top:3px}
.contrib{font-size:13px;color:var(--muted);margin-top:10px}
.actions{margin-top:12px}
.fixbtn{min-height:44px;padding:8px 14px;border:1px solid var(--accent);border-radius:6px;background:transparent;color:var(--accent);font:inherit;font-size:14px;cursor:pointer}
.cemsel{width:100%;padding:8px 10px;border:1px solid var(--line);border-radius:6px;background:var(--chip);color:var(--ink);font:inherit;font-size:14px}
.retry{background:none;border:0;padding:0;font:inherit;color:var(--accent);text-decoration:underline;cursor:pointer}

/* Contribution form (Task 9) */
.addbtn{min-height:44px;padding:8px 14px;border:1px solid var(--accent);border-radius:6px;background:transparent;color:var(--accent);font:inherit;font-size:14px;font-weight:600;cursor:pointer;align-self:flex-start}
.card.form{width:min(440px,calc(100% - 24px))}
.cform .fsub{margin:2px 0 0;color:var(--muted)}
.cform .frow{display:flex;flex-direction:column;gap:4px;margin-top:12px}
.cform label,.cform .flabel{font-size:13.5px;font-weight:600}
.cform input[type=text],.cform input[type=email],.cform textarea{width:100%;padding:10px 12px;min-height:44px;border:1px solid var(--line);border-radius:6px;background:var(--bg);color:var(--ink);font:inherit;font-size:16px}
.cform small{color:var(--muted);font-size:12.5px}
.cform .fbtns{display:flex;flex-wrap:wrap;gap:8px}
.cform button,.cform .fsubmit{min-height:48px;padding:8px 14px;border:1px solid var(--accent);border-radius:8px;background:transparent;color:var(--accent);font:inherit;font-size:15px;cursor:pointer}
.cform button.close{min-height:44px;min-width:44px;border:0;color:var(--muted)}
.cform .fsubmit{display:block;width:100%;margin-top:14px;background:var(--accent);color:var(--accent-ink);font-weight:600}
.cform .fsubmit:disabled{opacity:.6;cursor:progress}
.cform .fpos{font-size:13.5px;color:var(--muted)}
.cform .fphotos{list-style:none;margin:0;padding:0}
.cform .fphotos li{display:flex;align-items:center;justify-content:space-between;gap:8px}
.cform .fphotos button{min-height:44px;border-color:var(--line);color:var(--muted)}
.cform .fphotomsg,.cform .ferr{color:var(--grave);font-size:13.5px}
.cform .ferr:not(:empty){margin-top:10px}
.cform .fcheck{display:flex;gap:10px;align-items:flex-start;font-weight:400;margin-top:6px}
.cform .fcheck[hidden]{display:none}
.cform .fcheck input{width:24px;height:24px;flex:none;margin:0}
.cform .fgdpr{font-size:12.5px;color:var(--muted);margin-top:12px}
.cform .fdone{font-size:16px}
.xhair{position:absolute;width:44px;height:44px;margin:-22px 0 0 -22px;pointer-events:none;z-index:3;transform:scale(calc(1 / var(--s, 1)));
  background:linear-gradient(#0b57d0,#0b57d0) center/2px 100% no-repeat,linear-gradient(#0b57d0,#0b57d0) center/100% 2px no-repeat;filter:drop-shadow(0 0 2px #fff) drop-shadow(0 0 2px #fff)}
.xhair::after{content:"";position:absolute;inset:12px;border:2px solid #0b57d0;border-radius:50%}
#vp.picking{cursor:crosshair}
@media (max-width:760px){
  .addbtn{position:fixed;left:12px;bottom:calc(var(--sheet-h) + 12px);z-index:3;min-height:48px;padding:10px 16px;border-radius:12px;background:var(--panel);box-shadow:0 2px 8px rgba(0,0,0,.3);transition:bottom .25s ease}
  html[data-sheet="full"] .addbtn{visibility:hidden}
}
@media (max-width:760px) and (prefers-reduced-motion:reduce){.addbtn{transition:none}}
