/* ФПСМ · Е-мапа app layout (light + dark). Load after fpsm-section.css and map.css. */
body.fpsm-emap-page{overflow:hidden}
body.is-emap-fs .fpsm-shell-top,
body.is-emap-fs .site-header,
html:fullscreen .fpsm-shell-top,
html:fullscreen .site-header,
html:-webkit-full-screen .fpsm-shell-top,
html:-webkit-full-screen .site-header{display:none !important}
body.is-emap-fs .site,
body.is-emap-fs.fpsm-emap-page .site{height:100dvh}
.emap:fullscreen,
.emap:-webkit-full-screen{
  width:100vw;
  height:100dvh;
  inset:0;
  background:#c9d2cc;
}
html[data-theme="dark"] .emap:fullscreen,
html[data-theme="dark"] .emap:-webkit-full-screen{background:#1e2e29}
body.fpsm-emap-page .site{display:flex;flex-direction:column;height:100vh;height:100dvh;overflow:hidden}
body.fpsm-emap-page .site-footer,
body.fpsm-emap-page footer.site-footer,
body.fpsm-emap-page .site-footer__bar{display:none !important}
body.fpsm-emap-page #content,
body.fpsm-emap-page .site-main{flex:1;min-height:0;display:flex;flex-direction:column;padding:0;max-width:none;width:100%}
body.fpsm-emap-page .fpsm-pateki-map-section{flex:1;min-height:0;position:relative;display:flex;flex-direction:column;margin:0;padding:0;max-width:none}
body.app{height:100vh;height:100dvh;display:flex;flex-direction:column;overflow:hidden}
.emap{position:relative;flex:1 1 auto;min-height:0;width:100%}
#map{position:absolute;inset:0;width:100%;height:100%;z-index:0}
.leaflet-top.leaflet-right{top:4px;right:4px}

/* ---------- tool rail ---------- */
.rail{position:absolute;z-index:1002;left:12px;top:12px;display:flex;flex-direction:column;gap:4px;padding:6px;background:var(--surface);border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow-sm)}
.rail button,.rail a{position:relative;width:42px;height:42px;border-radius:10px;display:grid;place-items:center;color:var(--head)}
.rail [hidden]{display:none !important}
.rail button:hover{background:var(--surface-2)}
.rail button[aria-pressed="true"]{background:var(--solid-bg);color:var(--solid-fg)}
.rail .lb{position:absolute;left:52px;top:50%;transform:translateY(-50%);background:var(--solid-bg);color:var(--solid-fg);font-size:13px;font-weight:600;padding:4px 10px;border-radius:7px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .12s}
.rail button:hover .lb,.rail button:focus-visible .lb{opacity:1}
.rail hr{border:0;height:1px;background:var(--line);margin:3px 4px}

/* ---------- side panel ---------- */
.epanel{position:absolute;z-index:1001;left:76px;top:12px;bottom:12px;width:360px;display:flex;flex-direction:column;background:var(--surface);border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow);overflow:hidden}
.epanel[hidden]{display:none}
.ep-grab{display:none}
.ep-head{display:flex;gap:10px;align-items:flex-start;padding:16px 14px 14px 18px;border-bottom:1px solid var(--line)}
.ep-head .tt{flex:1;min-width:0}
.ep-head .eyebrow{font-size:13px;letter-spacing:1.6px}
.ep-head h2{font-size:23px;margin-top:2px;line-height:1.15}
.ep-head .sub{font-size:14px;color:var(--muted);margin-top:3px}
.ibtn{width:36px;height:36px;border-radius:9px;display:grid;place-items:center;color:var(--head);flex:none}
.ibtn:hover{background:var(--surface-2)}
.ep-body{flex:1;overflow:auto;padding:12px 0 16px;overscroll-behavior:contain}
.ep-body::-webkit-scrollbar{width:10px}.ep-body::-webkit-scrollbar-thumb{background:var(--line);border-radius:10px;border:3px solid var(--surface)}
.ep-search{margin:2px 16px 10px;display:flex;align-items:center;gap:8px;height:44px;border:1.5px solid var(--line-strong);border-radius:10px;padding:0 12px;background:var(--bg)}
.ep-search input{flex:1;border:0;outline:0;background:transparent;font-size:15.5px;min-width:0}
.ep-search input::placeholder{color:var(--muted)}
.ep-hint{font-size:14px;color:var(--muted);padding:0 18px 6px}
.ep-grp{font-size:13px;font-weight:600;letter-spacing:1.4px;text-transform:uppercase;color:var(--muted);padding:14px 18px 6px}
/* rows */
.er{display:flex;align-items:center;gap:12px;width:100%;text-align:left;padding:10px 14px 10px 18px;border-radius:0}
.er:hover,.er.hl{background:var(--surface-2)}
.er .tx{flex:1;min-width:0}
.er b{display:block;font-weight:600;color:var(--head);line-height:1.3}
.er small{display:block;font-size:14px;color:var(--muted);line-height:1.4}
.er .chev{color:var(--muted);flex:none}
.er .bar{width:4px;align-self:stretch;border-radius:3px;flex:none}
.er .st{font-size:14px;color:var(--text);font-variant-numeric:tabular-nums;margin-top:2px}
.er .st span + span:before{content:"·";margin:0 6px;color:var(--muted)}
.er.all b{color:var(--link)}
.ep-note{margin:12px 18px 0;font-size:14px;color:var(--muted);border-top:1px solid var(--line);padding-top:12px}
/* trail detail */
.td{padding:4px 18px 0}
.td .diff{margin-bottom:12px}
.td-stats{display:grid;grid-template-columns:1fr 1fr;border:1px solid var(--line);border-radius:12px;overflow:hidden}
.td-stats div{padding:10px 14px;border-top:1px solid var(--line)}
.td-stats div:nth-child(-n+2){border-top:0}
.td-stats div:nth-child(2n){border-left:1px solid var(--line)}
.td-stats small{display:block;font-size:13px;color:var(--muted)}
.td-stats b{font:700 21px/1.2 Oswald;color:var(--head);font-variant-numeric:tabular-nums}
.td h3{font-size:17px;margin:18px 0 4px}
.td .acts{display:flex;gap:8px;margin-top:16px}
.td .acts .btn{flex:1}
.td .meta{font-size:14px;color:var(--muted);margin-top:14px}
.td .meta b{color:var(--head);font-weight:600}
.facts{display:grid;grid-template-columns:auto 1fr;gap:8px 14px;font-size:15px;margin-top:4px}
.facts dt{color:var(--muted)}.facts dd{text-align:right;font-weight:600;color:var(--head)}
.hut-detail .hut-full{font:700 16px/1.3 Oswald,sans-serif;color:var(--head);margin:0 0 4px}
.hut-detail p{margin:12px 0 0;font-size:15px;line-height:1.45}
.hut-detail .k{display:block;font-size:13px;font-weight:600;color:var(--muted);margin-bottom:2px}
.hut-detail .acts{flex-wrap:wrap}
.hut-detail a.link{color:var(--link);font-weight:600}
/* .emap a{color:inherit} would paint Ink on Forest — unreadable */
.emap a.btn{min-height:44px}
.emap a.btn-solid{background:var(--heritage);color:var(--paper);border-color:var(--heritage)}
.emap a.btn-solid:hover{filter:none;background:var(--forest);border-color:var(--forest);color:var(--paper)}
.emap a.btn-line{background:transparent;color:var(--head);border-color:var(--head)}
.emap a.btn-line:hover{background:var(--surface-2);color:var(--head)}
/* layers */
.lyrs{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;padding:4px 18px 0}
.lyr{text-align:center;font-size:14px;font-weight:600;color:var(--head)}
.lyr i{display:block;height:74px;border-radius:10px;background-size:cover;background-position:center;border:1px solid var(--line);margin-bottom:6px;box-shadow:0 0 0 0 transparent}
.lyr[aria-pressed="true"] i{box-shadow:0 0 0 3px var(--surface),0 0 0 5px var(--head)}
.sw{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 18px;border-top:1px solid var(--line);width:100%;text-align:left;font-weight:600;color:var(--head)}
.sw:first-of-type{margin-top:18px}
.sw .tg{width:44px;height:26px;border-radius:20px;background:var(--line-strong);position:relative;flex:none;transition:background .15s}
.sw .tg:after{content:"";position:absolute;left:3px;top:3px;width:20px;height:20px;border-radius:50%;background:#fff;transition:left .15s;box-shadow:0 1px 3px rgba(0,0,0,.3)}
.sw[aria-checked="true"] .tg{background:var(--solid-bg)}
.sw[aria-checked="true"] .tg:after{left:21px;background:var(--surface)}
html[data-theme="dark"] .sw[aria-checked="true"] .tg:after{background:#102B25}
/* legend */
.lgd{padding:0 18px}
.lgd li{list-style:none;display:flex;align-items:center;gap:14px;padding:9px 0;border-top:1px solid var(--line);font-size:15.5px}
.lgd li:first-child{border-top:0}
.lgd .sy{width:42px;display:grid;place-items:center;flex:none}
.lgd .sy .mk{position:static;width:24px;height:24px}
.lgd .sy .mk-start,.lgd .sy .mk-end{width:20px;height:30px}
.lgd .sy .mk-start svg,.lgd .sy .mk-end svg{width:20px;height:30px}
.lgd .sy .mk-hut{width:28px;height:28px}
.lgd .ln{width:40px;height:6px;border-radius:4px;box-shadow:0 0 0 2px #fff}
.lgd .dt{width:14px;height:14px;border-radius:50%;background:#1E6FD9;box-shadow:0 0 0 3px #fff,0 1px 4px rgba(0,0,0,.4)}

/* ---------- elevation float (same slot as the old #pateki-elev-float-host) ---------- */
.elev-float{position:absolute;z-index:1001;top:12px;right:56px;width:414px;max-width:calc(100% - 140px);background:var(--surface);border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow);overflow:hidden}
.elev-float[hidden]{display:none !important}
.elev-float__bar{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:38px;padding:6px 10px 6px 14px;border-bottom:1px solid var(--line);font:600 14px/1.2 Golos,var(--fpsm-font-body,sans-serif);color:var(--head)}
.elev-float .prof{height:116px;padding:0 8px 8px}
.elev-float.is-collapsed .prof{display:none}
.elev-float.is-collapsed .elev-float__bar{border-bottom:0}

/* ---------- trail bar (same slot as the old .pateki-map-trailbar) ---------- */
.selcard{position:absolute;z-index:1001;left:50%;bottom:22px;transform:translateX(-50%);display:flex;align-items:center;gap:12px;background:var(--surface);border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow);padding:8px 10px 8px 14px;max-width:min(640px,calc(100% - 120px));min-height:52px}
.selcard[hidden]{display:none !important}
.selcard .bar{width:4px;align-self:stretch;border-radius:3px;flex:none}
.selcard .tx{min-width:0;flex:1}
.selcard b{display:block;font-weight:600;color:var(--head);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.selcard small{display:block;font-size:13px;color:var(--muted);font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.selcard .btn{flex:none;min-height:44px}
.selcard .btn-solid{background:var(--heritage);color:#fff;border-color:var(--heritage)}
.selcard .btn-line[aria-pressed="true"]{background:var(--heritage);color:#fff;border-color:var(--heritage)}

/* ---------- tablet ---------- */
@media (max-width:960px){ .epanel{width:330px} }

/* ---------- phone: tool rail becomes a bottom bar, panel becomes a bottom sheet ---------- */
@media (max-width:700px){
  .rail{left:0;right:0;top:auto;bottom:0;height:calc(64px + env(safe-area-inset-bottom));flex-direction:row;justify-content:space-around;border-radius:0;border-width:1px 0 0;padding:5px 4px env(safe-area-inset-bottom);gap:0;box-shadow:0 -4px 16px rgba(0,0,0,.12)}
  .rail button,.rail a{width:auto;height:52px;flex:1;display:flex;flex-direction:column;justify-content:center;gap:3px;border-radius:10px}
  .rail .lb{position:static;transform:none;opacity:1;background:none;color:inherit;padding:0;font-size:13px;font-weight:600}
  .rail button[aria-pressed="true"]{background:var(--tint);color:var(--tint-fg)}
  .rail hr,.rail .d-only{display:none}
  .epanel{left:0;right:0;top:auto;bottom:calc(64px + env(safe-area-inset-bottom));width:auto;max-height:52%;border-radius:18px 18px 0 0;border-width:1px 0 0;box-shadow:0 -10px 30px rgba(0,0,0,.18)}
  .ep-grab{display:block;width:44px;height:5px;border-radius:5px;background:var(--line-strong);margin:8px auto 0;flex:none}
  .ep-head{padding:8px 12px 12px 18px}
  .ep-head h2{font-size:21px}
  .elev-float{top:8px;right:8px;left:8px;width:auto;max-width:none}
  .selcard{bottom:78px;left:10px;right:10px;transform:none;max-width:none;flex-wrap:wrap;gap:10px 10px;padding:12px}
  .selcard .tx{flex:1 1 calc(100% - 20px)}
  .selcard .btn{flex:1}
  .selcard small{white-space:normal}
  .leaflet-top.leaflet-right{top:2px}
  .leaflet-control-zoom{display:none}
  .leaflet-bottom.leaflet-right{bottom:64px}
}
