/* Scoped to the territorial inspector and contextual legend. */
#gsctxInspector { position:fixed; top:80px; left:max(410px,calc((100vw - 740px)/2)); z-index:9800; box-sizing:border-box; width:330px; max-width:calc(100vw - 24px); padding:18px; background:#0a1f2e; border:1px solid #47746a; border-radius:12px; box-shadow:0 12px 40px #0008; }
#gsctxInspector .gsctx-close { position:absolute; right:6px; top:5px; width:28px; height:28px; padding:0; font-size:20px; background:transparent; border:0; }
#gsctxInspector .gsctx-eyebrow { padding-right:14px; }
.gsctx-inspector { width:290px; max-width:100%; max-height:min(520px,60vh); overflow-y:auto; overflow-x:hidden; font:12px/1.5 system-ui,sans-serif; color:#eafff7; scrollbar-width:thin; overflow-wrap:anywhere; }
.gsctx-eyebrow { color:#85d8c8; font-size:10px; font-weight:700; letter-spacing:.35px; }
.gsctx-title-label { color:#9fc7c0; font-size:11px; margin-top:12px; }
.gsctx-inspector h3 { font-size:16px; line-height:1.35; margin:2px 0 14px; }
.gsctx-inspector dl { margin:0; }
.gsctx-field { margin:0 0 10px; }
.gsctx-field dt { color:#9fc7c0; font-size:11px; }
.gsctx-field dd { margin:1px 0 0; white-space:pre-wrap; }
.gsctx-inspector details { border-top:1px solid #33524f; padding-top:8px; }
.gsctx-inspector summary { cursor:pointer; color:#9ee5d6; }
.gsctx-technical { margin-top:14px; }
.gsctx-technical dl { padding-top:12px; }
.gsctx-technical dt { overflow-wrap:anywhere; }
.gsctx-reference summary { list-style:none; }
.gsctx-reference summary > span:first-child { color:#eafff7; }
.gsctx-reference[open] summary > span:first-child { display:none; }
.gsctx-expand { display:block; font-size:11px; margin-top:4px; }
.gsctx-reference p { margin:8px 0 0; }
.gsctx-local { color:#ffd194; font-size:11px; margin:8px 0; }
.gsctx-legends { max-height:min(380px,38vh); overflow-y:auto; scrollbar-width:thin; padding:10px 0 0; border-top:1px solid #33524f; overflow-wrap:anywhere; }
.gsctx-legend-layer h4 { font-size:12px; color:#eafff7; margin:12px 0 6px; }
.gsctx-legend-row { display:flex; gap:8px; align-items:center; margin:5px 0; font-size:11px; color:#d4eee7; }
.gsctx-symbol { width:30px; height:18px; flex:none; }
.gsctx-inspector, .gsctx-legends { overscroll-behavior:contain; scrollbar-color:#47746a transparent; }
.gsctx-shared-symbol { align-items:flex-start; }
.gsctx-category-list { min-width:0; line-height:1.65; }
.gs2-collapsed .gsctx-legends { display:none; }
@media(max-width:900px) {
  #gsctxInspector { left:12px; top:70px; }
  .gsctx-inspector { max-height:calc(100dvh - 125px); width:290px; }
}

#legend:has(.gsctx-legends) #legendFamily:empty { display:none; }

@media(max-width:600px) {
  /* Keep the close button and contextual legend accessible together. */
  #gsctxInspector .gsctx-inspector { max-height:32dvh; }
  #legend:has(.gsctx-legends) { left:12px; max-width:calc(100vw - 24px); }
  .gsctx-legends { max-height:26dvh; }
  /* On phones, stack the three existing scroll regions while inspecting context. */
  body:has(#gsctxInspector):has(.gsctx-legends) #gsctxInspector .gsctx-inspector { max-height:22dvh; }
  body:has(#gsctxInspector) #legend:has(.gsctx-legends) { top:calc(118px + 22dvh); bottom:auto; }
  body:has(#gsctxInspector) .gsctx-legends { max-height:16dvh; }
  body:has(#gsctxInspector):has(.gsctx-legends) #panel { max-height:calc(62dvh - 220px); }
}
