#map { height:100%; width:100%; }

#panel{
  position:absolute; top:10px; left:48px; z-index:9999;
  width:280px; max-height:calc(100% - 40px); overflow:auto;
  background:rgba(20,20,20,0.72); color:#eee;
  border-radius:10px; padding:14px;
  font-family:system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  backdrop-filter:blur(6px);
  box-shadow:0 10px 30px rgba(0,0,0,0.35);
}

#panel h1{ margin:0 0 10px 0; font-size:18px; letter-spacing:1px; }

.nav-section-title{
  font-weight:700;
  margin-top:12px;
  cursor:pointer;
  user-select:none;
}

.nav-list{ margin-top:6px; }
.nav-list.is-collapsed{ display:none; }

.nav-link{
  display:block; margin:4px 0; padding:7px 10px;
  border-radius:8px; text-decoration:none; color:#eee;
  background:rgba(255,255,255,0.12);
  font-size:13px; line-height:1.15;
}

.nav-link:hover{ background:rgba(255,255,255,0.20); }
.nav-link.active{ background:rgba(255,255,255,0.32); }
.nav-link.disabled{ opacity:0.4; pointer-events:none; }

/* --- Spaces grouped navigation --- */
.nav-subgroup{ margin-top:10px; }

.nav-subgroup-title{
  cursor:pointer; user-select:none;
  padding:7px 10px; border-radius:8px;
  background:rgba(255,255,255,0.10);
  font-size:13px;
  display:flex; justify-content:space-between; align-items:center;
}

.nav-subgroup-title:hover{ background:rgba(255,255,255,0.16); }

.nav-subgroup-title .left{
  display:flex; gap:8px; align-items:center; min-width:0;
}

.nav-subgroup-title .caret{
  opacity:0.9; width:14px; text-align:center;
}

.nav-subgroup-title .count{
  opacity:0.85; font-size:12px;
}

.nav-subgroup-list{
  margin-top:6px; margin-left:10px;
}

.nav-subgroup-list.is-collapsed{ display:none; }

/* Popup */
.popupWrap{ width:360px; }
.popupTopRow{ display:flex; gap:10px; align-items:flex-start; }
.popupText{ flex:1 1 auto; min-width:0; }

.popupTitle{ font-weight:700; margin:0 0 6px 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
 }
.popupDesc{ margin:0; color:#444; 
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.popupMainImg{
  width:140px; height:auto; display:block;
  border-radius:8px; cursor:pointer; flex:0 0 auto;
}

.thumbRow{
  display:flex; 
  flex-wrap:wrap;
  gap:6px; 
  overflow-x:visible; 
  padding-top:8px;
}

.thumbRow img{
  width:70px; height:52px; object-fit:cover;
  border-radius:6px; cursor:pointer; flex:0 0 auto;
  border:1px solid rgba(0,0,0,0.15);
}

.status{ margin-top:10px; font-size:12px; opacity:0.9; white-space:pre-wrap; }

.back-link{
  display:block;
  margin: 0 0 10px 0;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color:#eee;
  background: rgba(255,255,255,0.12);
  font-size: 13px;
}
.back-link:hover{ background: rgba(255,255,255,0.20); }

#overlay .slide-stage{
  display:flex;
  justify-content:center;
  align-items:center;
}

#overlay #slideMetaWrap{
  position:absolute;
  top:14px;
  left:14px;
  padding:0;
  margin:0;
  background:transparent;
  z-index:10;
}

#overlay #slideMeta.is-hidden{ display:none; }

/* Center the whole slideshow column */
#overlay .overlay-card{
  align-items:center;
}

/* Let the image determine the real width (centered) */
#overlay .slide-frame{
  display:inline-block;   /* IMPORTANT: shrink-wrap to image width */
  width:auto;
  position:relative;
}

/* Image sizes naturally; no forced 100% width */
#overlay #slideImg{
  display:block;
  max-width:92vw;
  max-height:72vh;
  height:auto;
}

/* Controls should match the rendered image width (set by JS var) */
#overlay{
  --sl-imgw: auto;
}

#overlay .controls{
  width: var(--sl-imgw);
  margin: 0 auto;                 /* center under image */
  display:flex;
  justify-content:space-between;  /* left group vs Close */
  align-items:center;
  box-sizing:border-box;
}

/* Keep Prev/Next together on the left */
#overlay .controls-left{
  display: flex;
  gap: 10px;
}